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

Selective/partial chunk loading #48

Open
prydin opened this issue Jun 2, 2020 · 0 comments
Open

Selective/partial chunk loading #48

prydin opened this issue Jun 2, 2020 · 0 comments

Comments

@prydin
Copy link
Contributor

prydin commented Jun 2, 2020

Some applications, like mappers, benefit from caching chunks and regions locally. However, a fully loaded region can take up significant space in memory, which limits the usefulness of caches.

I'm proposing a mechanism for loading only the portions of a chunk or region that an application intends to use. Then, the internal reference to data in the chunks could be released to allow it to be garbage collected.

I propose something like this:

MCAFile::public void deserialize(RandomAccessFile raf, int fieldFlags) throws IOException

It would be used like this:

mca.deserialize(file, BLOCK_IDS|HEIGHTMAPS|BLOCKLIGHT);

A chunk loaded this way cannot be written to disk and any attempt to do so should throw an exception.

If this seems OK, I will prepare a PR with the changes.

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

No branches or pull requests

1 participant