-
Notifications
You must be signed in to change notification settings - Fork 105
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
Map pages consumes a lot of Memory in browser #270
Comments
Sadly not enough time to help. |
This is a somewhat known issue if I am not mistaken, see #191 with a difficult solution and not a lot of time going around to fix it. |
Correct, this library should not reuse polygons or other objects automatically. I only mentioned reuse as a workaround that users might use for the current version of the library since it does not dispose of polygons with BGM ought to ensure that JS garbage collection will dispose of objects after C# disposes of the JSInterop handle, since there is no way for C# to reconnect with these JS objects. I know for sure that happens if you call IIRC when a map is disposed, we loop connected objects such as markers and delete them. However we still currently have a JS memory leak for anything other than event listeners which aren't connected to a map when their C# handle is disposed as no map's dispose loop will find them. |
Map dispose function does some deleting. I read somewhere that dispose object could be enough to set it to null. Maybe set object to null and then remove from map element array. Maybe there is bug in this code.
|
When I plot a lot of circles, the browser task manager shows that the memory footprint of the page gets high very quickly.
In this pull request, I implemented the IAsyncDisposable pattern as per MS documentation in order to try and reclaim the memory, but even after everything is disposed the memory stays high.
I suspect that items on the JavaScript side are not being disposed properly, but I'm afraid its a bit out of my comfort zone.
I have added a demo page for reproducing the issue (
/dispose-circle-list
)Examples:
Memory before plotting:
Memory After plotting 6k circles:
Memory after plotting 6k circles and disposing circles & map:
The text was updated successfully, but these errors were encountered: