> -----Original Message----- > From: Nathan Nobbe [mailto:quickshiftin@xxxxxxxxx] > Sent: 16 June 2011 17:51 [...] > Here's what's going on, I instantiate a model object for the product > table > from my application > > $newRecord = new Product(); > > at this point memory usage goes up noticeably. I don't really care > though > because I figure I can delete it, but look at this madness I have > going > (which *fails* to free up the memory) > > $newRecord->clearRelated(); > $newRecord->free(); > unset($newRecord); > gc_collect_cycles(); > > after all of this memory consumption is still dramatically higher > than prior > to the first call creating the object above. This I've verified > through > memory_get_usage(). > > here's the output from the memory_get_usage() calls > > int(166461440) // before new Product() > int(169345024) // directly after new Product() > int(169345024) // after madness trying to free memory used by new > Product() I know nothing about Doctrine, but after all the unrelated discussion and your renewed plea for someone to address the issue, I decided to write conduct some simple tests. So I wrote a very simple class that basically just hogs some memory when instantiated, and tried some simple instantiations and releases. At each stage, I measured current and peak memory usage, and the results were: Initial Usage = 262,144 Peak = 262,144 After single instantiation ($a = new Hog();) Usage = 3,932,160 Peak = 3,932,160 After resetting that to NULL ($a = NULL;) Usage = 524,288 Peak = 3,932,160 After second single instantiation ($b = new Hog();) Usage = 3,932,160 Peak = 3,932,160 After instantiating 3 more Usage = 15,728,640 Peak = 15,728,640 After resetting all those to NULL Usage = 1,310,720 Peak = 15,728,640 After 4 instantiations again Usage = 15,728,640 Peak = 15,728,640 This seems to be pretty much what I (and you!) would expect, indicating that the memory used by objects can be recovered by PHP when the object is released. This being the case, I would suggest that something in your script is not freeing things up the way it should, the prime candidate being the clearRelated() method. Either that, or you have circular references that the gc_collect_cycles() function is unable to recover. But, bottom line, I'd say you're right that it's probably a Doctrine-related issue as the underlying PHP functionality seems to work reasonably well. Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, 507 Portland Building, City Campus, Portland Way, LEEDS, LS1 3HE, United Kingdom E: m.ford@xxxxxxxxxxxxxx T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm