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

Bad maximum heap size on large initial heap #608

Closed
UltimatePea opened this issue Jan 10, 2024 · 4 comments
Closed

Bad maximum heap size on large initial heap #608

UltimatePea opened this issue Jan 10, 2024 · 4 comments

Comments

@UltimatePea
Copy link

In an attempt to work around issue #604, running libgc complied program with env GC_INITIAL_HEAP_SIZE=100G results in the following error on the latest master.

GC Warning: Bad maximum heap size 68719476736 - ignoring it.
Can't start up: not enough memory
@ivmai
Copy link
Owner

ivmai commented Jan 10, 2024

I can't reproduce it on master (Linux, 64-bit).

GC_INITIAL_HEAP_SIZE=100G GC_PRINT_STATS=1 ./gctest
Supported VDBs: manual soft mprotect
Using soft-dirty bit feature
In-use heap: 0% (0 KiB pointers + 0 KiB other)
Grow heap to 104857600 KiB after 0 bytes allocated

@UltimatePea
Copy link
Author

GC_INITIAL_HEAP_SIZE=100G ./gctest
Supported VDBs: manual soft mprotect
GC Warning: Bad maximum heap size 68719476736 - ignoring
Switched to incremental mode
Emulating dirty bits with mprotect/signals
Completed 6 tests
Allocated 11792895 collectable objects
Allocated 1224 uncollectable objects
Allocated 720438 atomic objects
Reallocated 36 objects
Garbage collection after fork is tested too
Finalized 13393/13393 objects - finalization is probably OK
Total number of bytes allocated is 1154623152
Total memory use by allocated blocks is 3457024 bytes
Final heap size is 659456 bytes
Unexpected heap growth - collector may be broken (heapsize: 107382521856, expected: 159383552)
Test failed
fish: Job 1, 'GC_INITIAL_HEAP_SIZE=100G ./gct…' terminated by signal SIGABRT (Abort)

Strange. I am suspecting that this may be related to WSL2. I am trying a genuine linux installation.

@ivmai
Copy link
Owner

ivmai commented Jan 10, 2024

I think the root cause of this is that GC_MAXIMUM_HEAP_SIZE environment variable is defined somewhere else to a value which is smaller than GC_INITIAL_HEAP_SIZE, thus you are getting a warning that the initial size value is greater than the maximum one.

@ivmai ivmai closed this as completed Jan 10, 2024
@ivmai
Copy link
Owner

ivmai commented Jan 10, 2024

"Can't start up: not enough memory" means libgc can't allocate the amount of memory given in GC_INITIAL_HEAP_SIZE.

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

2 participants