-
Notifications
You must be signed in to change notification settings - Fork 188
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
MapiResponse never gets garbage collected in Node #396
Comments
Just following up on this. We ended up removing the mapbox SDK and calling the directions REST API directly instead. You can see pretty clearly in the graph, I think it's pretty obvious when we made the change! |
I'm having the same issue. Looking through the code it seems that this object here |
We got hit by this as well. Thanks @kascakm for the pointer to the leak - this helped us verify it was the same problem. We also moved to web api and now everything is fine. |
We also have to move rest api because of this issue. |
I created a PR for this: #496 tested locally, seems to fix the memory build up issue |
We have a memory leak issue with a Node app that appears to be caused by MapiResponse never getting cleaned up by the garbage collecter. We are creating a client and using to get directions as below using Node v12.16:
But we can see that

MapiRequest
andMapiResponse
never get cleaned up. Looking at heap snapshots from prod we can see these just keep growing (example here has grown up to 90MB just forMapiResponse
)I have also reproduced running locally in the Chrome debugger. I can see these objects build up and never get removed even when I manually run a GC in Chrome.
It looks like the SDK uses the global namespace so I guess this is why they are never GC'd? Is there something special we should be doing in Node to avoid this issue?
The text was updated successfully, but these errors were encountered: