Hello,
This is a noob question, but I'm trying to set a low heap size (4MiB) for an embedded application and I can't seem to succeed.
I also tried setting both a near limit callback and a GC epilogue and they don't get called.
I am initializing the Isolate with constraints set via ConfigureDefaultsFromHeapSize with both initial and max heap sizes set to 4MiB.
I'm trying to run a script that has just "a = Array(20000000).fill(2)".
Heap statistics right after Isolate initialization:
total_heap=962560 total_heap_executable=524288 total_physical=438272 total_available=4246240 total_global_handles=0 used_heap=371424 heap_limit=4194304 malloced=16460 external=0 peak_malloced=8192 native_ctx=0 detached_ctx=0 zap_garbage=0
Heap statistics right after running the script:
heap total_heap=41496576 total_heap_executable=524288 total_physical=40568044 total_available=485100 total_global_handles=8192 used_heap=40900828 heap_limit=4194304 malloced=16460 external=0 peak_malloced=49208 native_ctx=1 detached_ctx=0 zap_garbage=0
Note that the total heap size is 40 MiB, despite the limit being 4 MiB.
Am I doing something obviously wrong? This is v8 10.0.139.15.
Thanks,
-Tudor.