|
From: Alan B. <abo...@ma...> - 2008-10-21 13:40:54
|
In fact, replacing the zend_list_insert by
ZEND_REGISTER_RESOURCE........ has the same effect that removing the
zend_list_addref().
Alan
Klaus Rechert wrote:
> Hi Alan,
>
> the __construct function looks like this now:
>
> PHP_METHOD(swfshape, __construct)
> {
> SWFShape shape = newSWFShape();
> int rsrc_id = ZEND_REGISTER_RESOURCE(return_value, shape,
> le_swfshapep);
> // int rsrc_id = zend_list_insert(shape, le_swfshapep);
> object_init_ex(getThis(), shape_class_entry_ptr);
> add_property_resource(getThis(), "shape", rsrc_id);
> zend_list_addref(rsrc_id);
> }
>
> Commenting the zend_list_addref() has no additional effect on memory
> usage here.
>
> Thanks
> Klaus
>
>> Hi Klaus,
>>
>> I was writing you a comment on bugzilla.... but still waiting the
>> account creation confirmation... here's what i wrote:
>>
>> If you comment the following line, in PHP_METHOD(swfshape,
>> __construct) method:
>> zend_list_addref(ret);
>>
>> The destructor is well called (verified with a printf in the
>> destructor). BUT, the PHP OBJECT doesn't seem to be freed by php
>> garbage collector. See what i get now:
>>
>> Beginning of script : 57368 bytes
>>
>> End of script : 769960 bytes
>>
>> So, there are still "memory leaks".
>>
>> Thanks,
>> Alan
>>
>> Klaus Rechert wrote:
>>
>>> It is me again ;)
>>>
>>> Just dug a little bit in ZEND sources. Using
>>> ZEND_REGISTER_RESOURCE() instead of zend_list_insert() made the
>>> destructor function working. Running again your testcase results in:
>>>
>>> End of script : 1012316 bytes
>>>
>>> instead of
>>>
>>> End of script : 1524912 bytes for Ming 0.4.2.
>>>
>>> One little step... :)
>>>
>>> Cheers
>>> Klaus
>>>
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> just checked your example. You are right PHP leaks. I'm not sure
>>>> why... There are destructor functions defined and registered, but
>>>> not called at all.
>>>>
>>>> I filed a bug
>>>> http://bugs.libming.net/show_bug.cgi?id=74
>>>>
>>>> Thanks
>>>> Klaus
>>>>
>>>>
>>>>
>>>>
>>>>> Hi guys, i'm wondering if you are aware of this problem using your
>>>>> extension (or in the php garbage collector) ?
>>>>>
>>>>> See my script and results: http://pastebin.ca/1231918
>>>>>
>>>>> Do you know why the memory of the php object are not freed ?
>>>>>
>>>>> Thanks,
>>>>> Alan
>>>>>
>>>>>
>>>> -------------------------------------------------------------------------
>>>>
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>> challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win
>>>> great prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in
>>>> the world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> Ming-devr mailing list
>>>> Min...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/ming-devr
>>>>
>>
>>
>>
>
--
Alan Boudreault
Mapgears
http://www.mapgears.com
|