-
Notifications
You must be signed in to change notification settings - Fork 113
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
Using a basic retainerReferenceFilter
causes Node OOM exception
#117
Comments
@singh-sp It is probably because your I will make a patch to MemLab so that its path finder will accommodate external leak filter better. You can also use the following code to unblock for now: retainerReferenceFilter(edge, _snapshot, isReferenceUsedByDefault) {
// memlab by default removes self-referencing edges
// and other V8 internal and hidden edges
if (!isReferenceUsedByDefault) {
return false;
}
// your logic to filter other edges
// return true or false
} Let me know if this fixes the OOM issue. |
…inder (#117) Summary: External leak filter's `retainerReferenceFilter` callback could return `true` for edges that shouldn't be used. For example, self-referencing edges cause to infinite loop when traversing from a node to the GC root. MemLab's default edge filter excludes these kind of edges, but MemLab's path finder didn't consider the case where external leak filter may bypass MemLab's internal edge filter. This diff makes a patch to MemLab so that its path finder will consider the case where external edge filter includes edges that should be bypassed. Differential Revision: D56803842 fbshipit-source-id: d25ab366c5a1562927d284299a0bcfb057d9330a
Thank you! That worked! 🎉 In simple terms: retainerReferenceFilter(edge, _snapshot, isReferenceUsedByDefault) {
// default case
return isReferenceUsedByDefault
} Quick question: By providing a custom |
@singh-sp If you meant to use the default edge filter, there is no need to provide the |
It will also affect the retainer size calculation and dominator calculation: |
Thanks for the explanation! That's helpful. I plan to use this filter to exclude certain edges (false positive leaks). I ran some tests, and it looks promising. I couldn't find anything in docs, but is there a utility function that can parse the returned object |
If the edges your filter excluded were the edge that must go through from the GC root to the leaked object, then it will remove the object (i.e., the false positive) from the final result. A bit more context: MemLab first uses the
Unfortunately, there is no utility function for parsing
If you would like to dive deeper, here is the code that generates memlab/packages/core/src/lib/Serializer.ts Line 486 in 0f11b29
|
Closing this issue as the patch has been released in |
Followed the example from here: https://facebook.github.io/memlab/docs/api/interfaces/core_src.ILeakFilter/#-optional-retainerreferencefilter-referencefiltercallback, but getting Node out of memory exception.
Tried
Node 16, 18 and 21
with 8GB memory. The snapshots are approximately 35 mb each -- can be reproduced using Memlab examples.Seems to be happening during/after this function call:
memlab/packages/core/src/lib/Utils.ts
Line 1818 in 3b05576
The text was updated successfully, but these errors were encountered: