Re: CODING_STANDARDS addition re: emalloc
| From: | Markus Fischer | Date: | Wed, 09 Oct 2002 14:01:32 +0000 |
| Subject: | Re: CODING_STANDARDS addition re: emalloc | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-89282@lists.php.net to get a copy of this message | ||
On Wed, Oct 09, 2002 at 09:47:10AM -0400, Jon Parise wrote :
> +[11] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
> + counterparts. These functions implement an internal "safety-net"
> + mechanism that ensures the deallocation of any unfreed memory at the
> + end of a request. They also provide useful allocation and overflow
> + information while running in debug mode.
> +
> + In almost all cases, memory returned to the engine must be allocated
> + using emalloc().
> +
> + malloc() should only be used in instances where you need to allocate
> + memory that will be freed (via free()) inside of a third-party library.
> + It should also be used in instances where allocated memory has to
> + survive between multiple requests.
> +
+1