Trying to figure out why VisualVM can't snapshot. Procedure:

  • Profiler -> Memory settings -> Record allocations stack traces
  • Profiler -> Profile -> Memory
  • Profiler -> Snapshot

It gives an error Failed to obtain results snapshot. The profiled application terminated Failed to obtain results snapshot. The profiled application terminated

Code

 import java.util.ArrayList; import java.util.List; import java.util.Random; public class Main { public static void main(String[] args) { List<Integer> arrayList = new ArrayList<Integer>(); Random random = new Random(System.nanoTime()); try { while (true) { Thread.sleep(100); arrayList.add(random.nextInt()); } } catch (Exception ignored) { } } } 

And a link to a huge log that does not fit here https://mega.nz/#!4FAzUJLL!7TsC1wgh0g9Vw4wMfh8QlgMGfLLP8s_J2-zMDU_3s0E

The second day I try to find out what the problem is. Help me please.

    2 answers 2

    This is a JDK error: https://bugs.openjdk.java.net/browse/JDK-8147451

    Judging by the comments, JDK 9 does not play, 9 is still in development, but you can try: https://jdk9.java.net/download/

    • Don’t you know there already has its support for json? - AlexOrtizzz
    • @ Alexey Perestoronin did not try, I recently heard that they want to transfer to the 10th. And so Gson completely satisfied. - Russtam
    • @Aleksey Perestoronin Droopnuli, quote: "We can reconsider this information and it will be more compact and expressive API." mail.openjdk.java.net/pipermail/jdk9-dev/2014-December/… - uthark

    Error Failed to obtain results snapshot. The profiled application terminated Failed to obtain results snapshot. The profiled application terminated Indicates that SnapShot cannot be received as the application is stopped. During profiling, your program tries to get some classloader sun.reflect.GeneratedSerializationConstructorAccessor{41-1} , while the Profiler Agent reports that the class name is null, however, the Visual VM program, specifically its Profiler Agent Communication Thread when getting a SnapShot, climbs into those parts of the program where its control values ​​are located (Probably) which causes SIGSEGV and the subsequent departure of the error.