Skip to content

Fix memory leaks#19

Open
Arooba-git wants to merge 2 commits into
rogi-sh:masterfrom
softwaredesign1234:master
Open

Fix memory leaks#19
Arooba-git wants to merge 2 commits into
rogi-sh:masterfrom
softwaredesign1234:master

Conversation

@Arooba-git
Copy link
Copy Markdown

Hello 👋
As part of our project, we are using Facebook's new Memlab tool to detect memory leaks in SPA applications.
While running the tool and analyzing the code of defichain-income, we saw that your project does a very good job of ensuring that all async operations are cancelled when the component is destroyed. However, as per Memlab execution results, we found a dangling subscription and some timers that were causing the memory to leak (screenshots below).

[before]
Screen Shot 2023-01-28 at 7 02 49 AM


Hence we added the fix by unsubscribing the subscription and clearing the timers in component destructors, and you can see the heap size and # of leaks reducing noticeably:

Screen Shot 2023-01-28 at 7 12 29 AM

You can analyze this and other potential leak sources, if you like, by running Memlab with a scenario file covering the maximum # of use cases.
Following is a sample of the scenario file we used (it needs to be a .js file but attaching here in .txt form):

deficiain-memlab-scenario.txt

Note that some other reported leaks (in Memlab) originated from Angular's internal objects, and hence were ignored.

@Arooba-git
Copy link
Copy Markdown
Author

bump @rogi-sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant