RE: [Boost-Users] shared_ptr memory leak (newb)
*string allocates it's own copy of the string, so your pmem pointer is leaked. STL's string templates manage their own memory, you never need to use new or delete to [de]allocate for them. --Mark Storer Software Engineer Cardiff Software #include <disclaimer> typdef std::disclaimer<Cardiff> Discard;
-----Original Message----- From: Aaron Campbell [mailto:yg-boost-users@m.gmane.org] Sent: Thursday, August 07, 2003 1:22 PM To: boost-users@yahoogroups.com Subject: [Boost-Users] shared_ptr memory leak (newb)
why does this leak memory from the first call to "new"? how can I prevent the leak?
wchar_t* pmem = new wchar_t[10]; boost::shared_ptrstd::wstring cp ( new std::wstring(pmem) );
thanks for the help, .Aaron
------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/EbFolB/TM -------------------------------------------------------------- -------~->
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (1)
-
Mark Storer