Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » Unable to delete heap dump file after getting ISnapshot object
Unable to delete heap dump file after getting ISnapshot object [message #1855123] Thu, 29 September 2022 09:20 Go to next message
Mahesh D is currently offline Mahesh DFriend
Messages: 4
Registered: May 2022
Junior Member
Hi,

I am using Eclipse MAT APIs to analyze the heap dump file. I am calling SnapshotFactory.openSnapshot() and passing the heap dump file as an argument to this method and getting the snapshot object.

Once the snapshot object is returned I am trying to delete the heap dump file from the disk. But I am getting the below error message while deleting a file. It looks like the file is still open in SnapshotFactory.openSnapshot() method.

Error - java.nio.file.FileSystemException: <HeapDump-File-Path>: The process cannot access the file because it is being used by another process

Here is a sample code:

try {

    String filePath = "HEAP_DUMP_PATH";
    File hdFile = new File(filePath);
    ISnapshot snapshot = SnapshotFactory.openSnapshot(hdFile,
					new HashMap<String, String>(), new SysOutProgressListener());
			
    Path path = Paths.get(filePath);
    Boolean isDeleted = Files.deleteIfExists(path);
} catch(Exception e) {
     e.printStackTrace();
}

[Updated on: Thu, 29 September 2022 09:27]

Report message to a moderator

Re: Unable to delete heap dump file after getting ISnapshot object [message #1855125 is a reply to message #1855123] Thu, 29 September 2022 09:37 Go to previous message
Mahesh D is currently offline Mahesh DFriend
Messages: 4
Registered: May 2022
Junior Member
I found the solution. I need to call SnapshotFactory.dispose(ISnapshot) method to release the resources.
Previous Topic:Issues using IBM Seamer DTFJ
Next Topic:Unable to build locally on linux
Goto Forum:
  


Current Time: Fri Apr 26 11:38:24 GMT 2024

Powered by FUDForum. Page generated in 0.04510 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top