-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SBJsonStreamWriter stringCache #55
Comments
This cache gave quite a bit of performance when parsing typical JSON where The idea behind making it static was that strings would stay cached even Stig On 17 March 2011 22:45, stevenreinisch <
|
I moved the cache to the instance level. But I did not measure the resulting I would like to cook up a patch .. would be my first one ever :). steven On Mar 18, 2011, at 5:56 PM, stig wrote:
|
Hi Steven, Have a look at this page: http://help.github.com/fork-a-repo/ Stig On 21 March 2011 15:39, stevenreinisch <
|
The patch as submitted is wrong: "stringCache" is never released, so effectively this fixes nothing. I just noticed this problem while tracking some memory leaks in the framework. Someone else already reported this issue at #67. |
hi,
I am using JSON v3.0beta1 (iOS) for iOS 4.2 and have a memory issue when serializing arrays or dictionaries with (id)JSONValue. Consider the following snippet:
When running this code with Instruments and the Allocations tool there is a steep increase of live bytes that are not freed despite the autoreleasePool.
I think that the stringCache in SBJsonStreamWriter is the reason for this issue. It is created in the SBJsonStreamWriter's initialize method but never released. If I use the following macro, the steep memory increase disappears:
So, allocating and releasing the stringCache for each SBJsonStreamWriter instance solves the memory issue but I did not investigate in how far performance is affected.
What was the idea behind using a static stringCache?
regards,
steven
The text was updated successfully, but these errors were encountered: