4 ms·
> Memory might need to be cleaned up if the program was being run embedded in something else Just unmap the heap pages. Don't run the GC! > global destructors
by chrisseaton 7y ago
> Memory might need to be cleaned up if the program was being run embedded in something else
Just unmap the heap pages. Don't run the GC!
> global destructors, while not guaranteed, can be very helpful if you let them run
If you want them to run on exit then you want Runtime.runFinalizersOnExit, not the GC. Finalizers are non-deterministic, asynchronous, and would take an indefinite number of GC cycles to run them for all objects.