Try mixing on C++ class with constructor/destructor and see if they get called, I know 
this is one of problem of mixing under
VC++.  FYI, under Windows mixing the API(GlobalAlloc/Free, LocalAllocFree), c-runtime 
memory (malloc,free), and C++(new, delete)
causes major problems because they come from separate heaps.

Jeff Ishaq wrote:

> I used CW6 and tried the permutations of mixing new, MemPtrNew, delete, and
> MemPtrFree.
>
> There were no crashes, and 100% of the memory was reclaimed in all cases.
>
> These are just facts -- I'm not advocating mixing these calls!
>
> I initially asked because I came across an instance where memory was
> allocated with MemPtrNew, and then deleted elsewhere with 'delete', and I
> was surprised that it didn't cause any trauma.  Very interesting.
>
> Thanks!
> -Jeff
>
> -----Original Message-----
> From: Scott Maxwell [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 11, 2000 11:37 AM
> To: Palm Developer Forum
> Subject: Re: Mixing MemPtrNew and delete
>
> Aren't new and delete actually mapped to MemPtrNew and MemPtrFree?  Anyway,
> this is not guaranteed so the answer is really, even if it works, don't do
> it.  Why worry about it breaking in the future?
>
> Scott Maxwell
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Thursday, February 10, 2000 1:44 PM
> Subject: Re: Mixing MemPtrNew and delete
>
> >
> >
> > Well, it just won't work. You're allocating with one memory manager and
> > deallocating with another memory manager. The two are not necessarily
> > interchangable.
> >
> > -- Keith
> >
> >
> >
> >
> >
> >
> > Jeff Ishaq <[EMAIL PROTECTED]> on 02/10/2000 12:57:56 PM
> >
> > Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
> >
> > Sent by:  Jeff Ishaq <[EMAIL PROTECTED]>
> >
> >
> > To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
> > cc:    (Keith Rollin/HQ/3Com)
> > Subject:  Mixing MemPtrNew and delete
> >
> >
> >
> >
> > So what bad things can become of this:
> >
> > CharPtr myStringP = (CharPtr) MemPtrNew( 50 );
> > delete myStringP;
> >
> > And of course this:
> >
> > CharPtr myStringP = new char(50);
> > MemPtrFree (myStringP);
> >
> > Just a passing thought,
> > -Jeff
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please
> > see http://www.palm.com/devzone/mailinglists.html
> >
> >
> >
> >
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
> >
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palm.com/devzone/mailinglists.html


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to