Jerry Krinock
unread,Jan 30, 2011, 11:32:13 PM1/30/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to BSJSONAdditions
I was getting "out of memory" errors (Note 1) when parsing a JSON
string of 440K characters. I fixed it by adding a local autorelease
pool in the implementation of -[NSScanner(BSJSONAdditions)
scanJSONObject:]. Specifically, in NSScanner+BSJSONAdditions, line
66, before the while(){} loop, add this line:
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init ] ;
and the, of course, after the while(){} loop, at line 75, add this
line:
[pool release] ;
Note 1: I thought that Mac OS X doesn't give "out of memory" errors,
just slows your system to a crawl as it uses gigabytes of virtual
memory, sometimes requiring a logout or restart if things get bad
enough. But there it was in the console, "Out of memory", several of
them! Maybe Apple has fixed this in a recent Snow Leopard update,
10.6.6?