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

Prevent the GC from collecting "this" and "pixels" #1258

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

mattleibow
Copy link
Contributor

@mattleibow mattleibow commented Apr 28, 2020

Description of Change

Prevent the GC from collecting this and some cases where we no longer reference the object, just pixel data.

Reading pixels takes long enough that the GC will collect the object. Use GC.KeepAlive to prevent this.

Often the cause is that we go SKImage -> SKPixmap. This basically tells the GC that the bitmap is free, but in actual fact it is not - the pixmap is just a pointer to the pixel data.

Bugs Fixed

API Changes

None.

Behavioral Changes

Preserve this.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation

Reading pixels takes long enough that the GC will collect the object. Use GC.KeepAlive to prevent this.
@mattleibow mattleibow changed the title Prevent the GC from collecting "this" Prevent the GC from collecting "this" and "pixels" Apr 28, 2020
@mattleibow mattleibow merged commit 22fcbe7 into master Apr 29, 2020
@mattleibow mattleibow deleted the dev/preserve-this branch April 29, 2020 01:51
@mattleibow mattleibow added this to the v1.68.2 milestone Apr 29, 2020
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

Successfully merging this pull request may close these issues.

1 participant