Skip to content
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

Callback induced memory leakage in Image caching #61

Open
roosmaa opened this issue Nov 2, 2013 · 0 comments
Open

Callback induced memory leakage in Image caching #61

roosmaa opened this issue Nov 2, 2013 · 0 comments

Comments

@roosmaa
Copy link

roosmaa commented Nov 2, 2013

When using the ImageView.doOnLoad, the closure is leaked due to Callback not clearing the closures on it's "to run when fired list" after being fired.

diff --git a/packages/lib/Callback.js b/packages/lib/Callback.js
index 7a610c9..b476f20 100644
--- a/packages/lib/Callback.js
+++ b/packages/lib/Callback.js
@@ -67,6 +67,8 @@ exports = Class(function() {
                for(var i = 0, len = cbs.length; i < len; ++i) {
                        if (cbs[i]) { cbs[i].apply(this, arguments); }
                }
+               // Clear listeners to prevent leakage:
+               cbs.length = 0;
        };

        this.chain = function(id) {
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

No branches or pull requests

1 participant