At 10:09 AM 2/17/2002 +1100, Harry Ohlsen wrote:
> > What I don't understand is:
> >
> > 2) How can Poser tell this is a leak if the app hasn't ended?  i.e. How
> > does it know this is a leak as opposed to memory that I'm not finished
> > using?
>
>I can't answer the other questions, but imagine if you had code like ...
>
>    char *fred;
>
>    fred = MemPtrNew(100);
>    fred = MemPtrNew(100);
>
>One can tell this is a leak, even at runtime, because the only reference you
>had to the first allocated memory was fred.  If you update fred to point
>somewhere else, it's obvious that there's no way you can ever get access to
>the original 100 bytes again.

Hi Harry,

Thanks for the response.  I agree that in a simple case like this it might 
be possible to detect a leak although I'm skeptical that Poser does 
this.  In general, however, this type of determination is not 
possible.  For example, consider

fred = MemPtrNew(100);
SomeFunc(fred);
fred = MemPrtrNew(100);

Is it still a leak?

Bob


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to