I’m trying to generate some performance plots of my code which is manipulating data structures of ever increasing size. The way that I currently do this is to just run the program with different limits of what I’m pretty sure will finish. But I’d love to set limits which are too large and just have the program run until it fails, and then let my huge structure allocations go out of scope, and continue with smaller sized structures. Then finally compute and plot the results.
Can this be done? Can I really catch and handle out-of-memory exceptions? I remember in the old days in C, when I called
malloc returned 0, then I could handle this in my C-program.
In Scala/JVM if I get an out-of-memory exception, does that mean something has been corrupted? or did it fail to allocate and avoid the corruption?