Hello Moriyoshi,
to me that sounds good.
Tuesday, July 1, 2003, 7:33:08 PM, you wrote:
MK> Hi,
MK> Perhaps I'm missing something, but I noticed the current ZE2
MK> implementation doesn't seem to correctly handle constants registered to
MK> internal classes. I tracked down the cause of this problem, and finally
MK> figured out that those constants are destroyed by the ordinary
MK> zval_ptr_dtor_wrapper() at the destruction of the constant hash after the
MK> deactivation of the memory manager. Then I'm putting forward the following
MK> ideas to avoid this.
MK> 1. Unify the calls of pefree() / efree() by a function pointer followed by
MK> the actual memory block which directs to the actual free() implementation
MK> the memory block should be freed by. Here's the example stuff I'm
MK> referring to:
MK> typedef struct _memblk_t {
MK> void (*free_fn)(void *ptr);
MK> byte blk[];
MK> } memblk_t;
MK> void efree_impl(void *ptr)
MK> {
MK> ...
MK> }
MK> void pefree_impl(void *ptr)
MK> {
MK> free(ptr);
MK> }
MK> void *pemalloc_impl(size_t sz)
MK> {
MK> return malloc(sz);
MK> }
MK> void *pemalloc(size_t sz, int persistent)
MK> {
MK> void *ptr;
MK> if (persistent) {
MK> ptr = emalloc_impl(sz + sizeof(memblk_t));
MK> ptr->free_fn = efree_impl;
MK> } else {
MK> ptr = pemalloc_impl(sz + sizeof(memblk_t));
MK> ptr->free_fn = pefree_impl;
MK> }
MK> return (void *)ptr->blk;
MK> }
MK> void efree(void *ptr)
MK> {
MK> memblk_t *actual_head;
MK> actual_head = (memblk_t *)((byte *)ptr - &((memblk_t *)0)->blk);
MK> actual_head->free_fn((void *)actual_head);
MK> }
MK> 2. Add some new constructors / destructors dedicated to the persistent
MK> zvals, like ALLOC_INIT_PERSISTENT_ZVAL(), persistent_zval_dtor(), or
MK> persistent_zval_ptr_dtor(). I don't like this idea though.
MK> Any opinions?
MK> Moriyoshi
--
Best regards,
Marcus mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php