Skip to content

Calling exit() after OutOfMemoryError does not exit program #38657

Closed
@feli-citas

Description

@feli-citas

Trying to exit a Dart program after catching an OutOfMemoryError leads to the following behavior (call to exit happens right after printing oom):

out/DebugIA32/dart --enable-interpreter --optimization_level=3 --old_gen_heap_size=128 out.dill                      
foo0 throws
X0().foo0_1() throws
[9223372032559808639, 91, -58, -37, -39, 82, -45]
Exhausted heap space, trying to allocate 16 bytes.
oom
Exhausted heap space, trying to allocate 24 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
Exhausted heap space, trying to allocate 16 bytes.
...

To reproduce:
fuzz.dart.txt

sdk/pkg/vm/tool/gen_kernel --gen-bytecode --platform=sdk/out/DebugIA32/vm_platform_strong.dill -o out.dill fuzz.dart.txt
sdk/out/DebugIA32/dart --enable-interpreter --optimization_level=3 --old_gen_heap_size=128 out.dill

OutOfMemoryError is thrown in X2.foo2_0().

Metadata

Metadata

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.dartfuzzFound with Dart fuzzing (DartFuzz, libFuzzer, etc.)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions