Re: Question about emalloc
| From: | Brian 'Bex' Huff | Date: | Thu, 17 Oct 2002 15:13:40 +0000 |
| Subject: | Re: Question about emalloc | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-16428@lists.php.net to get a copy of this message | ||
Im pretty sure you still need to 'efree' what you 'emalloc'. Every time I forgot to 'efree' something, I would get a bunch of error messages about memory leaks. The errors were nice and verbose, tho... as long as I was running the debug version of the dlls.
So either the documentation is wrong, and you have to efree everything... or else the error messages about memory leaks that I keep getting can be ignored...
I'd be curious to know the answer as well...
--
Brian 'Bex' Huff
bex@stellent.com
Phone: 952-903-2023
Fax: 952-829-5424
> Not too sure if I am in the right place, but here goes...
>
> I am working on writing my own module and so far seem to be doing OK, but I
> have one quick question. In the Memory Management section of the manual
> (Ch. 26) it says:
>
> "emalloc(), estrdup(), estrndup(), ecalloc(), and erealloc() allocate
> internal memory; efree() frees these previously allocated blocks. Memory
> handled by the e*() functions is considered local to the current process and
> is discarded as soon as the script executed by this process is terminated."
>
> Does this mean that I can emalloc a string and not have to worry about
> efree()'ing it at the end? Also, if it is local to the process, how can it
> be used to pass values out of a function?
>
> regards,
>
> Mikey
> "If you give someone a program, you will frustrate them for a day. If you
> teach them how to program, you will frustrate them for a lifetime."
**All Electronic Mail sent from the Stellent, Inc Electronic Communication Network is scanned by
Antigen 7.0.**