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

Add closure analyzer for avoiding memory leaks #724

Closed
Jand42 opened this Issue Jul 24, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@Jand42
Member

Jand42 commented Jul 24, 2017

There is an inconvenient source of memory leaks in most JavaScript engines: captured variables are tied to a Context object and even functions that do not use some (or any) variables from a Context still retain the whole object. This is described well here: http://point.davidglasser.net/2013/06/27/surprising-javascript-memory-leak.html

Adding a WebSharperAnalyzeClosures project property gives warnings on these kinds of captures, helping to eliminate memory leaks.

Usage: <WebSharperAnalyzeClosures>True</WebSharperAnalyzeClosures> or <WebSharperAnalyzeClosures>MoveToTop</WebSharperAnalyzeClosures>. The latter additionally moves all non-capturing lambdas to top level automatically (experimental).

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