Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFree resources from the texture cache as appropriate. #151
Conversation
src/freelist.rs
Outdated
| @@ -86,11 +86,12 @@ impl<T: FreeListItem> FreeList<T> { | |||
|
|
|||
| // TODO(gw): Actually free items from the texture cache!! | |||
| #[allow(dead_code)] | |||
| pub fn free(&mut self, id: FreeListItemId) { | |||
| pub fn free(&mut self, id: FreeListItemId) -> &mut T { | |||
This comment has been minimized.
This comment has been minimized.
glennw
Jan 26, 2016
Member
It's not safe to do this - the linked list of free items are stored inside the freed items themselves (for memory / perf reasons), so you can't reference the item after it's freed. Can you change the calling code to get the item first, extract the needed data and then free the item?
36aaaac
to
1ec4e58
glennw
added a commit
that referenced
this pull request
Jan 26, 2016
Free resources from the texture cache as appropriate.
For now, this just unconditionally frees unused resources from the previous frame after building a new frame. We may want to throttle this back at some point. Also, the cache used is potentially inefficient and can be easily improved. We don't free texture pages at the GL level yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
pcwalton commentedJan 26, 2016
For now, this just unconditionally frees unused resources from the
previous frame after building a new frame. We may want to throttle this
back at some point.
Also, the cache used is potentially inefficient and can be easily
improved.
We don't free texture pages at the GL level yet.