-
Notifications
You must be signed in to change notification settings - Fork 1
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
Garbage collection issues #5
Comments
Isn't that what Benjamin Gruenbaum is saying in http://stackoverflow.com/questions/20068467/do-never-resolved-promises-cause-memory-leak? |
Well, he said "I'm assuming you don't keep an explicit reference to it since that would force it to stay allocated.". That might not always be true. I could of course construct some contrived examples, but it is a general problem where promises are cached or queued. See http://stackoverflow.com/a/18745499/1048572 or http://stackoverflow.com/a/38778887/1048572 for examples of real code. Similarly, your |
Thanks for engaging. I have much to learn from you and others about both promises and GC, but my current level of understanding is that things that cannot be GC'd cannot be GC'd, and things that can eventually will be. I don't see how this differs depending whether the promise resolves or is left pending. A resolved/settled promise still could have another In the real world, promises are created in semi-transient contexts, such as an Angular component, to take just one example. The component defines promises, some of which may resolve, some of which may not. When the component is torn down, it no longer is referenced from anywhere and anything it itself references, including promises whether resolved or pending, is therefore subject to GC, or am I missing something? If I have some kind of application-level promise which for ease of discussion let's say is hanging off the window, then right, it cannot be GC'd. But that holds whether it has resolved or not. I haven't really thought through the issues of caching or queuing promises. I've never actually done that sort of thing, maybe I should. But again, are the relevant GC issues not the same no matter whether the promise is fulfilled or left pending? If you yourself decide to cache something in a semi-global way, then it's hard to complain that it won't be GC'd. In short, until you convince me otherwise, I have to disagree that whether a promise is fulfilled or not affects its GCability, and that therefore this constitutes an argument against modeling canceled promises as permanently pending, no matter what its other pros and cons. |
The problem would not be the promise hanging off the window until it is torn down, it's the things that hang off the promise - i.e. then installed callbacks. OK, your |
There must be something basic I am not understanding. I don't get how the
status of a promise, or whether or not something is chained from it, or
whether or not those handlers have been invoked or not, affects its
GCability.
|
It does not affect the collectability of the promise, but it does affect the collectability of the callbacks and everything they reference. |
Your FAQ state
Can you elaborate on that? I don't believe it.
The text was updated successfully, but these errors were encountered: