1

Is it possible to load objects from an .hprof file back into a Java program? I created a heap dump using VisualVM. I'm trying to use the dump not for analysis, but as a way to load an array of objects that I had in the program at that moment back into a Java program.

If the answer is no, then why not? Is it at least possible in theory? Or does the heap dump lose some information about the objects such that they cannot be recreated.

1 Answers1

0

If I understood your question correctly short answer would be no. But you could analyse your .hprof file using Eclipse plugin called: Memory Analyzer to better understand what was happening at the moment.

Marius Jaraminas
  • 813
  • 1
  • 7
  • 19
  • If the answer is no, I'd be interested as to why. Does the heap dump not store all the information necessary to reconstruct a given object? I've updated the question to add this. – Michael Hermenault Dec 18 '19 at 06:11
  • @MichaelHermenault the information is there, but not necessarily sufficient to restore an object. That’s like deserializing an object that never said that it was serializable. Consider the meaning of memory addresses, file descriptors, identity hashcodes, etc. and any object encapsulating an object containing such non-restorable information. – Holger Jan 10 '20 at 16:06