I guess, this is not it.

I'm only making a subroutine call into the shared lib
and the control returns to the caller application
after the call,where i make it a point to free the
memory.

In case of switching applications i've already used
MemPtrSetOwner.

And like is wrote in the earlier mail..the thing works
fine if i allocate memory onto the stack and then pass
it into the library.

Thanks
Nitin

--- Jim Schram <[EMAIL PROTECTED]> wrote:
> At 8:27 AM -0700 4/12/01, Nitin Nangia wrote:
> >i'm facing a problem wherein i get strange memory
> >crashes in my shared library if i pass memory
> >allocated on the heap using MemPtrNew intto it from
> >another application.
> 
> Memory allocated by an application is freed by the
> OS when the application exits. So if you pass one of
> these blocks of memory to the shared library, then
> quit the app, then later try to access that block of
> memory in your shared library (from the same or
> another application) it will be invalid. This is
> most likely the source of your crashes. This
> behavior is explained in detail in the memory
> management section of the docs.
> 
> One way to avoid this behavior is to give ownership
> of the memory block to the system before the
> application exits using MemHandleSetOwner(h, 0) or
> MemPtrSetOwner(p, 0). Another way is to use Feature
> Manager memory, though doing so requires that you
> use DmWrite to modify its contents (which can either
> be a good thing or a bad thing, depending on what
> you're trying to do).
> 
> Regards,
> 
> Jim Schram
> Palm Incorporated
> Partner Engineering
> 
> 
> -- 
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
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