My PHP memory_limit is 64M (which is pretty high to start with)
I have a MongoCollection::findOne() called in my PHP code where I “find one” by MongoId.
It works in most cases. However in some cases, it causes PHP to go over the memory_limit of 64M.
The data record in Mongo is at max, 3.5MB because Mongo does not allow more than 4MB.
When I run, memory_get_usage() before calling findOne(), its only about 4MB. So findOne() seems to have consumed the other 60MB+. Is this a memory leak or is there a design flaw in the way I store in Mongo?
My PHP Mongo driver is the latest 1.26
It would be helpful if you could post the exact code that you are running. It is most likely your code, but there is a chance that it could be a bug with the Mongo PHP drivers. The latest version of the drivers (1.2.9) seems to be a step backwards from previous versions. I myself found a bug in the driver that causes php to segfault on connection timeouts 😮 In a conversation that I had with a 10gen developer it was revealed to me that the php drivers are the least mature of all the languages, but I was told that they just hired a php developer so the drivers should be getting some love soon.