Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » Multithreading characteristics of MAT API
Multithreading characteristics of MAT API [message #1434969] Tue, 30 September 2014 21:51 Go to next message
Dario Russi is currently offline Dario RussiFriend
Messages: 1
Registered: September 2014
Junior Member
Can someone share what the multithreaded characteristics of MAT are?
Specifically what operations can be performed over multiple threads when working with the API.
For instance, if I look at
org.eclipse.mat.parser.internal.SnapshotFactory.openSnapshot(File file, Map<String, String> args, IProgressListener listener)
there is a usage of a snapshotCache that does not appear to be synchronized and it seems it could lead to problems, though I have not looked at all implications of that problem.
Of course I can synchronize getting Snapshots but I wonder what else can go wrong if I tried to operate on Snapshots from multiple threads.

Is MAT entirely single threaded? (from a usage perspective not internally).
Is it only single threaded with respect to a Snapshot?
Is it multithreaded (except for obtaining the Snapshot from the file)?

Thanks

dario
Re: Multithreading characteristics of MAT API [message #1450342 is a reply to message #1434969] Wed, 22 October 2014 10:49 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
I don't think we have done a lot of work making MAT thread safe, other than not wanting problems to occur when analyzing multiple dumps from the UI.

I'd like it to be safe, but it may require some code review and changes.

Separate snapshots should be independent - though it looks like the loading could do with some protection.

The snapshot itself is fairly static, but with some caching of fields or class objects. The index API linking objects IDs to addresses, outbound references, inbound references does have caching too. I can't remember if these were properly synchronized.

There is a little multithreading inside of MAT - for things like object marking for finding which objects are reachable from others. There has been a request to make parsing multi-threaded, but that could be difficult as a lot of the time is spent reading the snapshot dump file. Also, I don't know whether the IBM DTFJ readers are thread safe, so we could have to lock on those. I'd expect them to be safe across different dumps.

As many machines now have multiple threads/cores we should improve this aspect of MAT. Dario, perhaps you could look to find some other suspicious areas.

Andrew

Previous Topic:Heap Analyzer
Next Topic:Hash Entries throwing Java_Version error
Goto Forum:
  


Current Time: Thu Mar 28 21:18:30 GMT 2024

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

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

Back to the top