-
Notifications
You must be signed in to change notification settings - Fork 49
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
Somewhat more detailed usage instructions #71
Comments
Hi @pjdevries I need to write something since forever but I did not took the time to do it yet. Here are some pointers:
KCacheGrind allows to do that by navigating in functions in different ways. The left pane is a list of all functions seen by the profile: Here is the meaning of the columns:
You can sort this table by clicking on the headers. I recommend clicking on the Sorting by In any case, clicking on one function allows to explore the call graph in various ways in the right pane: For example the "Call Graph" visualization at the bottom allows to find the call path leading to the function. If a function has more than one parent, you can see which path leaks the most memory. You can click around to focus on a different function. "Caller" refers to parent functions (functions that called the selected function), while "Callee" refers to child functions (functions that was called by the selected function). Note about allocating vs holding memory: Usually the memory allocated by one function is held somewhere else. So, one function may be responsible for allocating a lot of memory, but an other piece of code is responsible for holding this memory, preventing it from being freed. Memprof reports where the memory was allocated but not where it's being held. So, after finding the biggest allocator/leaker, you need to find where this memory goes:
Examples:
Let me know if this helps or if something needs clarifications. I will use this as a base when writing something later. |
Hi @arnaud-lb. Thanx again for the swift response. Yes, your elaborate explanation helps an awful lot. It is exactly the kind of information I have been trying to find, DuckDuckGoing for quite a bit. This will definitely help me find the sore spot. Thank you very much! |
@arnaud-lb, PS: if they are indeed all leaks, does that mean none of them will get picked up by the garbage collector? or there's a way to tell what's left even after garbage collector is ran? Please kindly advise |
this is really the point here... clearing this would help a lot |
@maxgalbu this is covered in the initial comment:
If memory allocated by a function still exists when the dump is generated, it is reported; incl. is the amount of memory allocated by the function and all it's children that remains, and self is the memory allocated without it's children that remains if you're taking a dump as that last thing in your application, only memory that has "leaked" will remain in the profile. It does not show overall usage. Leaked in this case could be legitimate uses which are just not cleaned up though, for example class properties on classes that have yet to be garbage collected. In response to @yu0307's question of
This kind of "leak" at the end of your request lifecycle isn't necessarily negative because the php engine will deallocate all resources for the request when it finishes. |
Description
Hi @arnaud-lb. This is not a not a regular feature request and also not a bug report. But since there is no specific support section and I didn't now where better to ask this question, I think posting it as a feature request is be the best next thing :)
I'm usually somewhat slow of understanding and this is one of those cases. Now I finally got memprof working and got some results, I need to analyze them. Not my daily routine, so it takes some effort. In this special case, I need to figure out where exactly memory is kept in use, resulting in the fatal memory exhaustion error. With a
memory_limit
of 4096M, something appears to be seriously wrong. One of the Features mentioned in the README is: "Reports non-freed memory at arbitrary points in the program". However, using KCachegrind I have no clue where or how that data is visualized.Can you help me get started? If this is the wrong place for these kind of usage questions, please point me in the right direction for next time.
The text was updated successfully, but these errors were encountered: