|
From: <abo...@ma...> - 2008-10-29 13:03:34
|
Absolutly,
It's really in the php extension. I'm wondering what happen.. if the object reference is properly removed for the list and the C destructor is well called, where could be the problem inside the extension? This could be inside php code. I don't think that extensions that use the new zend api have this problem.
Alan
-----Original Message-----
From: "Klaus Rechert" <kla...@rz...>
Sent: Wednesday, October 29, 2008 6:00am
To: "Alan Boudreault" <abo...@ma...>, "Ming Developers mailing list" <min...@li...>
Subject: Re: [Ming-dev] Memory problem with the php extension ?
Hi,
sorry I was mostly offline the last few days. I poked a little bit in
the code but haven't found a real solution yet.
For sure is:
1. ming's shape() does not leak (checked via a C testcase)
2. memory usage scales with the number of instances
I have the strong suspicion that the list holding the instances is not
cleared.
Cheers
Klaus
> Hi Klaus,
>
> I'm wondering if you have any new about the problem ? (Can you add me
> in CC in the bugzilla plz)
>
> Thanks,
> Alan
>
> Alan Boudreault wrote:
>> 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
>>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
>
|