Skip to content

Feature/preallocate large header - #83

Open
Siebje wants to merge 12 commits into
developfrom
feature/preallocate-large-header
Open

Feature/preallocate large header#83
Siebje wants to merge 12 commits into
developfrom
feature/preallocate-large-header

Conversation

@Siebje

@Siebje Siebje commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

This change allows pre-allocating a header of fixed size, which allows a user to make modifications and additions to the global parameters without needing to completely rewrite the file (up to the preset limit). The initial reserved size was 1MB, but it was reduced to 256kB after some user feedback.

// which is not been finalized in Java 21.
System.gc();
try {
Thread.sleep(100);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the sleep of 100ms needed here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered reading the comments, the commit log, or the method name? The name of the method is 'awaitFileUnmapping'. System.gc() returns immediately, which will lead to the file handle being kept open until the GC is complete.

Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
Comment thread TRS_FILE_FORMAT_SPECIFICATION.md Outdated
@Siebje
Siebje force-pushed the feature/preallocate-large-header branch from 143e368 to 39edc87 Compare August 21, 2026 13:35
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

Successfully merging this pull request may close these issues.

2 participants