pemalloc in PHP_MINIT_FUNCTION segfaults on win (but not on linux)
| From: | Holger Blasum | Date: | Tue, 13 Mar 2007 20:26:39 +0000 |
| Subject: | pemalloc in PHP_MINIT_FUNCTION segfaults on win (but not on linux) | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-4622@lists.php.net to get a copy of this message | ||
Hello pecl-dev,
executive summary: in php-5.2.0 (or 5.0.0), is it ok to do a pemalloc in
the PHP_MINIT_FUNCTION? If not, what is the appropriate (minimalist) way
to provide memory that is going to be shared globally among
all threads/clients?
slightly more verbose explanation: this is my PHP_MINIT_FUNCTION
PHP_MINIT_FUNCTION(stack) {
StackContext(s) = (STACK *)pemalloc(sizeof(STACK),1);
return SUCCESS;
} to have a globally shared stack. (To be shared among different
threads/clients.)
Much more detail (including full source of the toy 'stack' example) at
http://www.blasum.net/holger/journal/20070312/
(valgrinding it on linux gves me 'ERROR SUMMARY: 0 errors from 0
contexts (suppressed: 29 from 2)', for the suppressed ones i have 25
in libc5 and 4 in dl_relocate_object, so apparently not php-related)
Many thanks in advance for any help (e.g.: is this generally the
'right way' of doing this? (I admit that I wanted to avoid resources
because they seem thread-specific.) Did I make a subtle error or is it a
win-specific thing?... )
--
Holger Blasum +49-174-7313590 (cell) GnuPG 1024D/ACDFC3B769DC1ED66B47