Skip to content

Improve memory consumption by cleaning up garbage references to pending promise without canceller - #34

Merged
WyriHaximus merged 1 commit into
reactphp:masterfrom
clue-labs:garbage
Jun 13, 2018
Merged

Improve memory consumption by cleaning up garbage references to pending promise without canceller#34
WyriHaximus merged 1 commit into
reactphp:masterfrom
clue-labs:garbage

Conversation

@clue

@clueclue commented Jun 12, 2018

Copy link
Copy Markdown
Member

The previous changes in #33 improved memory consumption for settled promises somewhat. Similarly, this PR addresses memory consumption for pending promises that are no longer referenced.

Calling timeout() on a promise which has no canceller function does successfully reject the promise. However, due to internal references, it keeps a cyclic reference to the input promise and as such shows some unexpected memory consumption and memory would not immediately be freed as expected. Let's not call this a "memory leak", because memory was eventually freed, but this clearly caused some unexpected and significant memory growth.

I'm marking this PR as WIP because this includes a test for reactphp/promise#124 which is yet to be released as part of react/promise v2.7.0. Once this release is out, I'll update the version reference and this should be ready to be shipped.

Builds on top of #33

@clueclue changed the title [WIP] Improve memory consumption by cleaning up garbage references to pending promise without cancellerImprove memory consumption by cleaning up garbage references to pending promise without cancellerJun 13, 2018
@clue

clue commented Jun 13, 2018

Copy link
Copy Markdown
MemberAuthor

Updated and removed WIP marker now that https://github.com/reactphp/promise/releases/tag/v2.7.0 has been released, this is now ready :shipit:

@clue
clue requested review from WyriHaximus and jsorJune 13, 2018 16:12
@WyriHaximus
WyriHaximus merged commit 170fb93 into reactphp:masterJun 13, 2018
@clue
clue deleted the garbage branch June 13, 2018 16:44
@clueclue mentioned this pull request Feb 1, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@clue@jsor@WyriHaximus