Re: memory leak when referencing associative arrays

From: Date: Tue, 14 Feb 2006 10:23:18 +0000
Subject: Re: memory leak when referencing associative arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230357@lists.php.net to get a copy of this message
Gonzalo MC wrote:
Hi all, I'm having some pain with this process. I'll try to explain it well, my english is little bad... :-)
...
Does the php garbage collector keep track of uncollectable objects / zvals as python gc does? It is some way to freed some memory I know it should be really unreferenced? Some thing like a manual force to the garbage collection of a zval -associative array at php level-? Perhaps should I use a different mechanism for storing the associative arrays so I could not suffer this issue?
I don't think there is anything you can do to force garbage collection. note that the garbage collector is not capable of freeing memory for zvals that contain circular references (IIRC) - e.g. 2 objects with properties pointing to each other (I assume the same problem occurs if you have 2 arrays with items that are references to each other [or each others items?]). if you have circular references I would try to find a way to do it without them - it should help memory consumption (assuming you even have any references in your arrays) I take you are unset()ing the relevant variables already in your code?
If my trouble is not very clear, please don't hesitate to ask me. Thanks in advance. Regards, Gonzalo.


« previous php.general (#230357) next »