Outrunning the Garbage Collector
Outrunning the Garbage Collector
- Subject: Outrunning the Garbage Collector
- From: "Jeffrey J. Early" <email@hidden>
- Date: Thu, 7 May 2009 21:55:19 -0700
I have a multithreaded application with several NSOperationQueues and
it appears as if under heavy load conditions I'm overwhelming the
garbage collector so-to-speak.
I essentially have three queues which can be processing different
types of operations simultaneously.
- If I load up *one* queue with a bunch of operations and let it run,
I find that memory is clean up very nicely. After each operation
finishes it gets cleaned up by the collector appropriately.
- If I load up all three queues simultaneously (a not uncommon user
scenario for this application), then I find that rarely do any of the
operations get cleaned up. Things generally start out alright, but
then get jugged up and very quickly the application can run out of
memory.
I've tried suspending one of the operation queues for a few seconds
and asking the garbage collector to collect, but that didn't work.
I noticed in NSGarbageCollector.h that they say, "collects ..., but
subject to interruption on user input". What exactly is "user input"?
If I somehow block everything on the main thread for a short time,
will this allow the garbage collector to collect?
The GC release notes suggest that it's possible to "outrun" the
collector,
http://developer.apple.com/releasenotes/Cocoa/GCReleaseNotes/index.html
Thanks,
Jeffrey
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden