Re: Re[2]: NSTableView and memory management problem.
Re: Re[2]: NSTableView and memory management problem.
- Subject: Re: Re[2]: NSTableView and memory management problem.
- From: Matt Neuburg <email@hidden>
- Date: Mon, 28 Mar 2005 15:54:53 -0800
On Mon, 28 Mar 2005 22:52:30 +0200, Dmitry Basko <email@hidden> said:
>Hello,
>
>MN> Use ObjectAlloc, not Activity Monitor (as I've said three times in the last
>MN> week, it seems). That is the only way to pierce the veil of virtual memory
>MN> and see whether *you* are actually leaking memory. If you are not, then
just
>MN> don't worry about it. m.
>
>Thanks for your replay. I will bear it in mind. But it was only the
>first attempt to see what happens wrong with my code.
>
>Two additional words how my code works:
>a)Reading of table is divided into two parts.
>Before the Panel with grid is shown to user, I read 15 records. After
>that I am starting Timer object and show the Panel.
>b)in timer_action procedure I continue the reading of the rest and
>display the appropriated messages in case of need.
>(there is unexpected delay here, in reality it is the unwanted call of
>NSPopAutoreleasePool)
>
>When user wants to close the Data Viewer he presses button "Close" and
>inside of its handler I clean up and deallocate the used memory.
>a) delete all TableColumns;
>b) delete all cells (NSCell) inside of the certain row and the row
>itself (NSMutableArray)
>c) delete the main index array(NSMutableArray), previously containing
>rows (NSMutableArrays); I have not intentionally used "autorelease", I
>planed to clean up all by hands.
>
>Of course those operations require some time (it's clearly seen during
>the debug session) - seconds. After that application seems to be
>frozen (It does not consume CPU time (very little)) for 10-20 seconds.
>When I debug this stage in "step" mode I see that the code is calling
>"NSPopAutoreleasePool" again. So, there are two moments when very time
>consuming NSPopAutoreleasePool are called - when I leave "timer_action"
>function and when the modal panel is going to be closed.
>I think this behaivior generally is correct, but in my particular case these
>calls (NSPopAutoreleasePool) do only harm - they consume very valuable
>time, although all resources have been released manually.
>May be I misunderstand something but it would be good to avoid these
>calls - there is no real need, because no one object is supposed to be
>autoreleased.
How do you know what autoreleased objects there are and how they were
generated? Even if you think you didn't create any explicitly, the Cocoa
framework may have generated some as part of actions you are performing.
There is no point in guessing, expecting things to work a certain way, or
imagining you know something you don't know. Instead, use the tools you're
given. Use ObjectAlloc to find out what objects were really allocated. Use
Sampler and Spin Control to find out what's taking up the time when the
window closes.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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