I have a php script that parses large files (50MBish). In an attempt to limit memory usage I am parsing the file in chunks and assigning the contents of the chunk to an object property called fileContents. After parsing the chunk I then empty the fileContents and start again.
Strange thing is that memory usage is huge (>250MB for a 50MB file). My current hypothesis is that php does not shrink the allocation of memory for my object just because it drastically shrinks in size ie every time I delete the fileContents 'chunk'.
Anyone know any good sources on understanding php/apache's memory management and/or how I might be able to get round this problem. (One way might be to assign the 'chunk' to its own variable rather than make it part of the object but that will screw my architecture and make the message passing between methods very messy).
Any thoughts appreciated
Peter Dunham