-
Notifications
You must be signed in to change notification settings - Fork 238
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
Redo fragment caching to use less memory and store off-screen fragments #906
Open
burgerindividual
wants to merge
36
commits into
toolbox4minecraft:master
Choose a base branch
from
burgerindividual:multithreaded-fragment-cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Redo fragment caching to use less memory and store off-screen fragments #906
burgerindividual
wants to merge
36
commits into
toolbox4minecraft:master
from
burgerindividual:multithreaded-fragment-cache
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ld seed selected.
* Never recycle fragments (old code is still there, but dead). * Previously enqueued but no longer visible fragments are now still being queued to be loaded, but in the background, only after all visible but not loaded framents have been processed.
* Refactor cache handling * Revert unneeded changes * Add documentation
…at it's referent has not been cleared by the GC.
… unloaded fragments
recycle expired off screen cache fragments, make available queue have an expiration on fragments
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.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This also should close #564. Copied from my comment from then:
In short, the normal FragmentCache was removed, as well as the availableQueue. Now, there are separate classes OffScreenFragmentCache and AvailableFragmentCache. The off-screen fragments have a limited lifespan of 30 seconds so they don't take up too much ram, and they are also SoftReferences so they don't cause an OOME. The AvailableFragmentCache is in place of the old availableQueue and adds some extra features. It uses SoftReferences, and they have an expiration time of 60 seconds. A thread gets spawned to clean and maintain both of these caches every half a second. The times for each cache are modifiable in the settings, and either one can be set to never get removed.
With the FragmentCache being gone, this means that no cache will have the on-screen fragments once they are all done loading. We now have to get them from the FragmentGraph instead, and it's used for when we need to invalidate a layer and put the fragments back in the loadingQueue.
Overall, it should make the fragment pipeline a bit simpler and should also use a lot less ram.