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

High memory consumption in heavy coroutines #13

Closed
marcoonroad opened this issue Mar 16, 2020 · 2 comments
Closed

High memory consumption in heavy coroutines #13

marcoonroad opened this issue Mar 16, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@marcoonroad
Copy link
Owner

Long-running/expensive coroutines (calling often await this.suspend()) will increase memory consumption due .demands() and .supplies() being not garbage-collected.

Possible solutions are:

  • A flag (NO_STREAMS) during coroutine creation to avoid creating .demands() and .supplies() streams for heavy coroutines.
  • Making .demands() and .supplies() not idempotent, they'll just return the latest stream point available. To get all coroutine's events, clients should call such functions early (e.g, before first .resume() call).

(Issue open to track further discussion)

@marcoonroad marcoonroad added the bug Something isn't working label Mar 16, 2020
@marcoonroad marcoonroad changed the title Higher memory consumption in heavy coroutines High memory consumption in heavy coroutines Mar 16, 2020
@marcoonroad
Copy link
Owner Author

The former solution keeps backward-compatibility where the latter breaks it. Therefore, the first solution fits better as a bugfix patch, and the second solution can be deferred into next major release.

marcoonroad added a commit that referenced this issue Mar 16, 2020
Signed-off-by: Marco Aurélio da Silva <marcoonroad@gmail.com>
@marcoonroad
Copy link
Owner Author

marcoonroad commented Mar 16, 2020

The solution was 3 modes:

  • PERSIST, the default mode.
  • DISABLE, the former mode on original post.
  • COLLECT, the latter mode on original post.

No backward compatibility broken! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant