-
Notifications
You must be signed in to change notification settings - Fork 4
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
REQUEST: provide a bool arg to get_chunks
that doesn't cache the data
#14
Comments
Hum, that's a very good point! Yes, it can eat a lot of RAM if you load all chunks of a big world. To implement that bool arg (
In any case, as much as I endorse this feature, I'm currently too busy to come back to this project and implement this. But I'd welcome any PR that does, it could use the ideas I've outlined above as a guidance. |
Improvement: regardless of who does the initial filesystem scan, |
My understanding is this is done by the world when loading the dimensions and the loading is handled here. upon calling So a naive implementation of # in Regions
def uncache(self, pos):
# replace reference to RegionFile with that of the corresponding RegionPos
self[pos] = self[pos].pos If we also want to check the underlying file still exists, we can add the following in the method: # with `recursive` as boolean kwarg to the method, defaults to False
path = os.path.join(self.world.path, self.dimension.subfolder(), self.category)
candidates = list(pathlib.Path(path).glob(f"{'**/' if recursive else ''}r.{pos.filepart}.mca"))
if len(candidates) == 0:
del self[pos] I am not entirely sure this last part is needed though, at least as long as the user manually calls uncache (which means they are responsible ans should not what they are doing IMO)
They do so we could have an uncache method there too: # in RegionFile
def uncache(self):
self.regions.uncache(self.pos) |
Partially fixed by #16. Thanks to @NielsPichon now it's trivial to add the requested |
I'l like to iterate over all chunks in a world, but since the
Regions
hold on to the data, my RAM goes poof. Is there a way to "uncache" the data as I go along?The text was updated successfully, but these errors were encountered: