- is not a problem. When java process terminates you no longer can connect to it.
- you could run the same code 1000 times and make a snapshot in visualVM to analyze usages of memory, computations, etc. You'll have to divide the results by 1000.
This gives you better results (taking time of 1000 runs and getting average), since single run can take different time at each run.