Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 797 Bytes

30cd.md

File metadata and controls

17 lines (11 loc) · 797 Bytes

Back to questions

Solution to 30cd: Heap exhaustion

See code at solutions/code/tutorialquestions/question30cd

Examine class HeapExhaustion and compare it with your solution.

Running class HeapExhaustion from the sample solution three times in succession, I get the following output:

Length of list before memory exhausted: 11451103
Length of list before memory exhausted: 11451103
Length of list before memory exhausted: 11451103

The fact that the same number of objects added to the list before memory is exhausted in all three runs suggests (though of course provides no guarantee) that the Java Virtual Machine's memory allocator is behaving deterministically, allocating objects in the same manner on each run of the program.