This is a pre-release software documentation. It may be incomplete or not up-to-date.
Opening a big memory snapshot sometimes takes a lot of time.
When a snapshot is loaded for the first time the profiler can store some pre-calculated information, the snapshot index, to a file alongside the original snapshot. The snapshot index will make the next snapshot opening much faster.
Please also consider other approaches to make snapshot opening faster.
The snapshot index files may be helpful in analyzing big snapshots on a 32-bit workstation. The index files can be generated on a 64-bit machine, via the profiler UI or programmatically (see below), and then transferred back to your workstation, in order to accelerate the memory snapshot opening in future.
Saving the index from the profiler UI
When you close a memory snapshot opened in the profiler UI or exit the profiler UI with memory snapshots open, the index files will be created automatically if they do not exist.
You can turn the automatic saving of index files off with the help of Settings | Save Snapshot Index on Close
Also, you can manually save current snapshot's index with the help of File | Save Snapshot Index.
This can be useful if you have disabled the autosave.
Saving the index with the profiler API
You can create snapshot index file programmatically with the help of the profiler API:
File snapshotFile;
// ...
MemorySnapshot snapshot = new com.yourkit.api.MemorySnapshot(snapshotFile);
snapshot.saveIndexFile();
<Profiler Installation Directory>/lib/yjp.jar should be in the classpath.
Saving the index with command line tool
You can create snapshot index file using the following command:
java -jar <Profiler Installation Directory>/lib/yjp.jar -create-index <snapshot_file_path>
The index file location
When the profiler loads a memory snapshot, it looks for the index file in
the same directory as the snapshot file.
The index file name is formed from the snapshot file name with .index postfix added.
If there is no index file found, the snapshot will be opened from scratch.
For example:
Snapshot named foo.snapshot will have index file name foo.snapshot.index
Snapshot named bar.hprof will have index file name bar.hprof.index
When saving snapshot index, make sure the directory where snapshot is located is writable and there is enough disk space (the index size can be comparable with the size of the snapshot.)
