• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory management problem - solvee
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management problem - solvee


  • Subject: Re: Memory management problem - solvee
  • From: Michael Heinz <email@hidden>
  • Date: Sat, 6 Aug 2005 08:41:15 -0400

Thanks, Jon.

I've never used my own autorelease pool, I'll have to look into it.

On Aug 6, 2005, at 8:05 AM, Jonathan del Strother wrote:

I believe the standard way of handling this would be to create your own NSAutoreleasePool, which you can empty at periodic intervals. Autoreleased objects created within this loop will go into your own pool automatically :

NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
int pageIndex = 0;
while (pageIndex < totalPages)
{
    convertPage(pageIndex);
    pageIndex++;

if ((pageIndexP)==0) //Release the pool every 50 pages to clear it out
{
[myPool release];
myPool = [[NSAutoreleasePool alloc] init];
}
}
[myPool release];



Something like that, anyway.

Jon



On 6 Aug 2005, at 01:58, Michael Heinz wrote:


I figured out the solution to my problem; I broke my work loop into a routine which converted one page, then set a timer which called the work loop again to convert the next page, etc..

This approach allowed the main run loop to run interleaved with the work loop, so garbage collection and menu items work properly.

On Aug 5, 2005, at 6:48 PM, Michael Heinz wrote:



I've got a program to convert PDFs to Jpegs formatted for the Sony PSP (http://pdf2psp.sourceforge.net) that's got a nasty memory problem - when processing a large pdf it becomes huge (over a gigabyte!) - but when processing is finished it shrinks back to a svelte 2 megs.

Malloc debugger says I'm not leaking - but obviously I need to periodically force a garbage collection loop. Is there some way to force garbage collection to occur?

Can I spawn a secondary thread to do garbage collection?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden




--- Porkchop D. Clown Balloons, Buffoonery and Balderdash.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40steelskies.com


This email sent to email@hidden





--- Porkchop D. Clown Balloons, Buffoonery and Balderdash.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Need help with a nasty memory management problem (From: Michael Heinz <email@hidden>)
 >Memory management problem - solvee (From: Michael Heinz <email@hidden>)
 >Re: Memory management problem - solvee (From: Jonathan del Strother <email@hidden>)

  • Prev by Date: Re: Need help with a nasty memory management problem
  • Next by Date: Progress indicator in dock icon with animation
  • Previous by thread: Re: Memory management problem - solvee
  • Next by thread: Prevent a split view to resize a view when the window is resized ?
  • Index(es):
    • Date
    • Thread