stream_context_create memory leak

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
georgewr3
Forum Newbie
Posts: 9
Joined: Fri Jan 16, 2009 12:57 pm

stream_context_create memory leak

Post by georgewr3 »

stream_context_create seems to have a memory leak. This has been reported (http://bugs.php.net/bug.php?id=40257) but marked bogus for some reason.

I am using the code almost verbatim from this:
http://netevil.org/blog/2006/nov/http-p ... thout-curl

Running ps lax shows this code consuming more memory until the memory is exhausted.

I'm at version 5.2.6 already. Anyone know if it's been fixed or a workaround to the stream_context_create call?
robganly
Forum Newbie
Posts: 1
Joined: Fri Oct 16, 2009 9:22 am

Re: stream_context_create memory leak

Post by robganly »

hi there,

i'm having the same problem. i have traced the leak to a class that is using the stream_context_create function.

it is used in an import script for inputting data into an instance of solr, but is dying after tens of thousands of records (and i need it to be rock solid as it has to work on millions eventually!).

anyhow outputting memory_get_usage within a loop where the stream_context_create function is being used shows memory increasing with each iteration until the max is reached.

does anyone have any ideas how to solve this? it is pretty urgent!

best,

rob ganly
Post Reply