Doug,

I apologize, that was an error in my e-mail.  It should have read:

DOMString* myStr = new DOMString("foo");

as you also stated in your e-mail.  That is what the actual code I 
was compiling looked like.

I do delete the pointer later on in my code, but that is not the 
point.  My library literally terminates on the above call -- taking 
my Java application with it.

Toby

>Tobias,
>
>In C++, the new operator returns a pointer to the newly created object. So
>at first glance, your code should be modified to read:
>
>DOMString* pMyStr = new DOMString("foo");
>
>Later in your code, before pMyStr goes out of scope, you should call
>
>delete pMyStr;
>
>to release the memory explicitly or you will get a leak. (The use of p in
>the name is a common convention, though not of course required, that reminds
>you that you are working with a pointer to an object rather than the object
>itself.)
>
>Alternatively, if you do not need to allocate the object on the heap, you
>can create a temporary quite simply:
>
>DOMString myStr("foo");
>
>The string will get cleaned up automatically when myStr goes out of scope.
>
>Doug Brower

-- 
Tobias McNulty
Data Description, Inc.
840 Hanshaw Road, Suite 9
Ithaca, NY 14850
Phone: (607) 257-1000
E-mail: [EMAIL PROTECTED]
Web: www.datadesk.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to