Comments (7)
Thank you! That worked! 🎉
In simple terms:
retainerReferenceFilter(edge, _snapshot, isReferenceUsedByDefault) {
// default case
return isReferenceUsedByDefault
}
Quick question:
By providing a custom retainerReferenceFilter
, are users overriding any default behaviors? (other than what you mentioned)
from memlab.
@singh-sp It is probably because your retainerReferenceFilter
callback returned true
for edges that shouldn't be used. For example, self-referencing edges cause infinite loop when traversing from a node to the GC root. MemLab's default edge filter excludes these kinds of edges, but MemLab's path finder didn't consider the case where external leak filter may bypass MemLab's internal edge filter.
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.
from memlab.
@singh-sp retainerReferenceFilter
is exposed as an API so that you can override the edge filter used by the retainer trace generator. Edges returned as false
by retainerReferenceFilter
won't be used for calculating the retainer trace.
If you meant to use the default edge filter, there is no need to provide the retainerReferenceFilter
callback in the leak filter.
from memlab.
By providing a custom retainerReferenceFilter, are users overriding any default behaviors? (other than what you mentioned)
It will also affect the retainer size calculation and dominator calculation:
https://developer.chrome.com/docs/devtools/memory-problems/get-started
from memlab.
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 ISerializedInfo[]
from the findLeaks()
function? I plan to display detected leaks in a certain way, and it would be nice to access the leaked objects' names and other metadata. Currently, this object has dynamic keys, making it hard to access nested objects.
from memlab.
I plan to use this filter to exclude certain edges (false positive leaks).
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 leakFilter
callback to identify memory leak objects (if no leakFilter
callback is provided then MemLab uses its default object filter); then MemLab uses retainerReferenceFilter
to calculate the retainer trace (i.e., path to GC root) for those identified leaks.
is there a utility function that can parse the returned object ISerializedInfo[] from the findLeaks() function?
Unfortunately, there is no utility function for parsing ISerializedInfo
, which has the following format:
{
"0: edge0Name object0Name": {object0}
"1: edge1Name object1Name": {object1}
"2: edge2Name object2Name": {object2}
...
}
If you would like to dive deeper, here is the code that generates ISerializedInfo
:
memlab/packages/core/src/lib/Serializer.ts
Line 486 in 0f11b29
from memlab.
Closing this issue as the patch has been released in [email protected]
from memlab.
Related Issues (20)
- Can't switch chrome version HOT 2
- Idea - Question - Discussion - Using memlab to refactor code targeting different framework philosphy HOT 1
- Question - How does it pull memory information ? HOT 1
- 老哥有点问题,本地默认安装你的仓库里面有个依赖包引入 colors 的包默认是1.4.2的 被污染的那个包 导致 启动不起来,windows 开发环境, HOT 2
- Question: Any idea about ignoring weak reference and circular reference in heap snapshot? HOT 7
- takeHeapSnapshot timed out HOT 10
- core_1.browserInfo.setPuppeteerConfig is not a function HOT 2
- Is there a way to run in scripting mode using silent? HOT 4
- Could not find Chrome (ver. 121.0.6167.85). This can occur if either 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or 2. your cache path is incorrectly configured HOT 3
- Could not find Chrome (ver. 121.0.6167.85). This can occur if either 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or 2. your cache path is incorrectly configured
- Keep `@memlab/*` versions in lockstep in package.json HOT 1
- how to handle Page crashed error ,when execute the run method。 HOT 1
- how to get leak info from memlab console HOT 6
- Clarify the documentation about measure mode HOT 3
- Add ESM support for @memlab/api (and remaining) HOT 4
- Puppeteer browser.close() hangs on AWS Lambda HOT 2
- TypeError: core_1.utils.tryToMutePuppeteerWarning is not a function HOT 2
- Error occurs when executing scenarios involving dialog display HOT 1
- Need guidance on accessing elements in code using heap object ID HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memlab.