Re: [PHP-DEV] PHP 4.0 Bug #5620 Updated: Memory leaks with classes and references to objects From: Mark Melvin (melvin <email protected>)
Date: 08/15/00

I have two proposals regarding this memory leak cases

1. Having a force_unref() function that a user can explicitly mark his/her
variable as
unreferenced (ref_count = 0) in the end of his/her script, so it can then be
deallocated.
It might not be a polite manner, but it can break the circular reference.

2. Tagging the variables with the script run id, so that when the script
ends, it can
sweep the memory and deletes everything that has its run id, referenced or
not. The reason
is that objects are associated with instances of the script, and meaningless
outside the
scripts or when the associated scripts have died. This has a memory penalty
for the tagging
and the sweeps, that it might better be a config option for people that does
circular refs
but don't want the leaks. I think it would be a fair tradeoff.

I would like to hear what others think about this matter.

regards

Mark Melvin

----- Original Message -----
From: "Bug Database" <php-dev <email protected>>
To: <php-dev <email protected>>
Sent: Wednesday, August 16, 2000 01:32
Subject: [PHP-DEV] PHP 4.0 Bug #5620 Updated: Memory leaks with classes and
references to objects

> ID: 5620
> Updated by: waldschrott
> Reported By: h.raaf <email protected>
> Status: Closed
> Bug Type: Scripting Engine problem
> Assigned To:
> Comments:
>
> 1)
> leaking memory is the intended behaviour using circular
> references
> 2)
> you can do (in your code)...
>
> $oa->Bref->Aref->Bref->Aref->Bref.............
> how often you want to, thatīs circular
>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>