For memory profiling I successfully used http://www.eclipse.org/mat/ .
Simply run your test outside eclipse, make a heap-dump (I prefer JConsole) and analyze the heap-dump after the application has finished. MAT offers a quite intelligent mechanism to give you hints about the source of the evil.

Cheers,
Georg

Stanislav Muhametsin wrote:
I did a memory analysis on my 200-entity creating & removing test. Among many allocated objects, there were following:

Class | Live instances | Active size | Total Instances | Total Size | Avg age ------+----------------+-------------+-----------------+------------+--------
byte[]|         17 075 |   5 397 416 |         146 391 | 17 795 448 | 0,91
char[]|          5 848 |     522 272 |          89 025 | 13 435 464 | 1,24

I haven't profiled memory before, especially for Java, but that looks a little worrying. There were 200 entities, and it used 17M of byte-arrays and 13M of char arrays altogether? Sounds like a lot.

It doesn't tell which parts of program allocated those arrays ("Allocation Details" tab is nicely white and empty), but somehow it allocates 146 391 byte arrays, each avg sized 121 bytes, and with average age of 0.91 seconds. Not to mention the 13 million char arrays, each with avg size of 150 bytes. What the hell is going on here :)

Oh and I assume the profiler is *THAT* broken that it would tell wrong results, so far only problem is that it has been confused about generated classes and some info has been lacking, but so far I haven't detected the profiler actually giving out wrong info.

I'm including the test as inline attachment. With one profiler session, it said:

JUnit version 4.8.1
.18.2.2010 12:23:41 org.qi4j.entitystore.prefs.PreferencesEntityStoreMixin activate
INFO: Preferences store:/Application
24972 [main] INFO org.qi4j.index.rdf.newtests.RDFPerformanceTest - Time to create 200 entities (ms): 2425 34253 [main] INFO org.qi4j.index.rdf.newtests.RDFPerformanceTest - Time to complete creation uow (ms): 9281 45586 [main] INFO org.qi4j.index.rdf.newtests.RDFPerformanceTest - Time to delete 200 entities (ms): 11332 230464 [main] INFO org.qi4j.index.rdf.newtests.RDFPerformanceTest - time to complete deletion uow (ms): 184877

Time: 230,001

OK (1 test)

That was a particularly slow one, I think eclipse hit its max memory size.


------------------------------------------------------------------------

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to