You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe the releasing is based on what objects are determined to be reachable. In this case, you're using a package variable, so it's handled differently than if a were declared inside of main. Declaring it in main behaves as you would expect, rather than growing the heap to ~3-4GB.
If your program weren't actively allocating close to its max heap, the unused memory would be released when another memory-hogging program started. See also #29844 (comment)