-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak Log #1742
Comments
A memory leak means that PHP or an extension is using memory and is losing any reference to those data avoiding that these allocated memory could be released before. In this case, a transaction in the logger, keeps the messages in memory instead of flushing them one by one. If you want to use transactions you need that memory available for PHP in order to temporary store those data in memory. |
Oh doh! I'm sorry. I never thought that a single logger transaction would be too large to fit in memory for some reason. I'll test again once I have the chance. I had just assumed that every transaction would be able to fit into memory, and so running out of memory meant the log transcation was not being flushed after a commit() call. If I increase the memory limit to some size that is greater then any single transaction could be, and the code STILL crashes, would that imply that there could be a memory leak? Thanks! |
I think the issue is that Phalcon\Logger\Adapter::commit() does not clear the queue. |
So I tested on my not updated dll and the test case doesn't work (i.e. it's 2 in both cases). Will an updated dll be posted or do I need to switch to linux and build from source? |
I have some code that I use the logger, in this case specifically the FileAdapter logger. When I run the code using logger->begin() & logger->commit, the script runs out of memory (code is inserting ~1gb of data into db and generates roughly 1gb of logging info. Of course I do not log all 1gb in a transaction - it should be spread over ~100k transcations).
Code is at: https://gist.github.com/anonymous/8145276.
When I run the same code, commenting only logger->begin & commit calls, the script does not run out of memory. So basically, code with lines 120, 126 commented out runs, but uncommented runs out of memory pretty quickly (out of 1.6m records to insert, 17k are).
I'm using the 32 bit phalcon .dll on a windows machine.
I remember there used to be a guide to getting started on understanding phalcon C code which I attempted to find so I could look at source, but unfortunately I cannot find that now, but it seems to me the queue that stores transcation log messages is never freed?
I can post code
The text was updated successfully, but these errors were encountered: