Re: New Memory Manager
| From: | Christian Seiler | Date: | Tue, 14 Jan 2014 19:38:38 +0000 |
| Subject: | Re: New Memory Manager | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71127@lists.php.net to get a copy of this message | ||
Hi there,
(For example: may be someone would suggest how to avoid check for USE_ZEND_ALLOC=0 to allow system malloc() usage on each emalloc() call?Rename emalloc() -> real_emalloc(), then: .h: extern void (*emalloc)(size_t n); .c: void (*emalloc)(size_t n) = real_emalloc; startup code: if (USE_ZEND_ALLOC is 0) { emalloc = malloc; } Probably some adjustments needed (esp. for potentially different calling conventions, so maybe malloc() will need a small wrapper), this is just from the top of my head. Note: this breaks ABI compatibility on most archs (because it changes the symbol type). But could be done independently of anything else. Note 2: Depending on system architecture, each call to the function may incur an additional (small) penalty. No idea how this compares to the penalty of the if() at the start of emalloc(). Regards, Christian