UPDATE I noticed that with a particular require_once('myobject.php') that the memory increase showed up. This require_once() was run conditionally. When I moved the require_once()statement out of the if statement so it loads all the time, the memory increase went away. Doesn't make sense to me, but the issue is solved. I'm not sure this is actually an "answer" so I will leave it unanswered.
I have memory_get_usage()
in the footer of my page and with each refresh of the page, I watch it increase by about 100k each time. My page load creates many objects and destroys them when done . My parent objects each have __destruct()
which uses unset()
with all child objects. Child objects with a reference back to the parent, have __destruct()
to unset()
these references.
Inserting memory_get_usage()
before and after processing different parts of my page only tells me how much of the total usage was added due to that part of the script. How do I go about determining what memory is lost and not recycled for garbage collection after the page finishes loading?
I have one global $_SESSION var containing objects storing user info, but have verified using strlen(serialize($object)) that this object is not growing in size.
I presume that what I am seeing is a memory leak and that php garbage collection should be in effect after the script ends. Any ideas how to debug this?