Skip to content

Free vertex/index buffers after uploading to GPU #11434

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

Merged
merged 2 commits into from
Jan 24, 2022
Merged

Free vertex/index buffers after uploading to GPU #11434

merged 2 commits into from
Jan 24, 2022

Conversation

mourner
Copy link
Member

@mourner mourner commented Jan 24, 2022

Closes #11432. Array buffers weren't actually freed because we didn't also remove views that pointed to them. This PR restores the original intent of the optimization. I've launched some benchmarks on it — let's see if this makes a difference to performance.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • post benchmark scores
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Improve GL JS memory footprint by freeing memory more eagerly after loading tiles.</changelog>

Sorry, something went wrong.

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Jan 24, 2022
@mourner mourner requested a review from ansis January 24, 2022 11:10
@mourner
Copy link
Member Author

mourner commented Jan 24, 2022

Looks like it does improve memory footprint very significantly. For a typical dense view of SF, the main thread in main retains 16MB of typed arrays, while in this branch, it's 7MB.

Before After
image image

Benchmarks (loading-full) don't show meaningful deviations in most metrics, but total_objects_in_memory shows a clear win:

image

@mourner mourner merged commit b0d9152 into main Jan 24, 2022
@mourner mourner deleted the free-buffers branch January 24, 2022 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of array buffers once they're uploaded to GPU
2 participants