[GR-53451] Eagerly initialize libsvm_container #9484
Merged
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.
With this change, the
libsvm_containeris initialized eagerly, just after parsing isolate arguments. This allows us toContainerLibrary#isInitialized,PhysicalMemoryeagerly and thus toPhysicalMemory#isInitialzied()and the need to deal with the uninitialized case.As a result, the GC works with the right values from the beginning. This can be seen in action with a small test case:
Compile and build native image:
Running unrestricted (on a system with more than 500M ram):
Running in a cgroup restricted to 100M (e.g., via
systemd).Before:
Note that the
OutOfMemoryErrorwas not thrown, but the process was killed by the system due to exceeding its assigned memory. This is because the GC ran before the container support was fully initialized and thus worked with incorrect heap size assumptions.After:
With this change, the GC knows the right memory limits up front and can correctly throw the
OutOfMemoryError.