Bug #55033 [Bgs]: Memory Leak in magic method __get() [Zend Memory Manager]

From: Date: Sat, 11 Jun 2011 20:47:49 +0000
Subject: Bug #55033 [Bgs]: Memory Leak in magic method __get() [Zend Memory Manager]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161320@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=55033&edit=1

 ID:                 55033
 Updated by:         felipe@php.net
 Reported by:        rodney dot rehm at medialize dot de
 Summary:            Memory Leak in magic method __get() [Zend Memory
                     Manager]
 Status:             Bogus
 Type:               Bug
 Package:            Performance problem
 Operating System:   Mac OS X 10.6.7
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

Hi, this behavior is some needs to be changed, I'm not ignoring your point, just closed the
report since it has been already reported.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2011-06-11 21:45:56] rodney dot rehm at medialize dot de

Well, I figure since Bug #48197 is still open, the issue will be resolved eventually. 

If you're facing memory problems because of __get() you might want to sporadically clone the
object: $object = clone $object; The wasted memory is not cloned. Beware that you are trading memory
for runtime. Only consider this if you are facing memory issues or runtime is not an issue.

------------------------------------------------------------------------
[2011-06-11 17:42:22] rodney dot rehm at medialize dot de

Just to get this straight. This is not a bug, it's expected behavior.

Anything returned from a magic method is internally handled as a copy. That means that anything a
magic methods returns, even if it's a reference to another object, is kept in memory. That is,
until the $object the magic methods were invoked on, is unset().

Are you kidding me? Not a bug? Where is this not a bug?
A note on this topic wouldn't harm the docs, you know?

------------------------------------------------------------------------
[2011-06-11 17:02:32] felipe@php.net

A copy of returned variable is done.

------------------------------------------------------------------------
[2011-06-11 17:01:14] rodney dot rehm at medialize dot de

What exactly do you mean by "separating return from __get()"? The memory is pumped
regardless of how I return (value, reference). How am I supposed to "separate" here?

------------------------------------------------------------------------
[2011-06-11 16:48:14] felipe@php.net

There is no memleak, what happens is that the return from __get() needs to be separated.
See bug #48197

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=55033


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=55033&edit=1


Thread (7 messages)

« previous php.bugs (#161320) next »