|
From: <tar...@wi...> - 2002-05-16 10:00:14
|
Hi, 1. user code calls function which returns pointer to allocated memory 2. user code uses memory by pointer 3. user code must deallocate memory (by calling function) 4. user code is not allowed to access memory by pointer anymore. make shure that you use same syntax for free comand. Adib. Daniel Glenfield wrote: > I think that memory can be deallocated using free at any time so long as > you have char* still around. So I'm assuming in your function (method) > you have > char* pX; > pX malloc(whatever) ((I do C++)) > return pX; > > you can use pX in the main() function to deallocate with free. > > >> From: "J Miller" <jm...@we...> >> Reply-To: <jm...@we...> >> To: "Dev-C++ Users \(E-mail\)" <dev...@li...> >> Subject: [Dev-C++] Generic C++ question. >> Date: Thu, 16 May 2002 10:32:35 +0930 >> >> Hi all, >> >> If a method returns a char pointer (char*). >> >> If the above method does a malloc() to allocate memory >> for some text (or something) and then fills that memory. >> >> The char* is returned to the user code. >> >> Who (or which code) is responsible for doing a free() on the char*? >> >> John M' >> >> _______________________________________________________________ >> >> Have big pipes? SourceForge.net is looking for download mirrors. We >> supply >> the hardware. You get the recognition. Email Us: >> ban...@so... >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > -- WIGE DATA GmbH Wiesenring 11, D-04159 Leipzig, Germany Adib Taraben Electronic Engineer PHONE +49 (0)341 - 46 21 100 FAX +49 (0)341 - 46 21 400 E-MAIL tar...@wi... INTERNET www.wige-data.de A company of WIGE MEDIA AG |