I tried some other free tools, such as jmap (built-in) and jmp, but did not have any success.
DrMem is a simple agent that does a very simple thing and does it reliably and simply. It logs a snapshot of memory every X objects created. So you can set that to 100000 objects or a million objects. the default is 10 milion. It might be useful also for a deployment scenario where you have a slow memory leak. In development, if you set it to a low number, like 10,000, it is logging so much that it slows your app down.
Object allocation report from Tue Nov 24 09:29:28 2009
Number of objects: Currently 5290516, total 11700000
Class list follows:
Currently Total Size Class name
1118670 2338521 27184080 java.lang.String
1099143 2544624 57082952 java.lang.Object
227644 380377 31011472 com.mysql.jdbc.Field
217613 363530 9268712 com.webobjects.jdbcadaptor.JDBCColumn
207533 346759 4980792 com.mysql.jdbc.Buffer
207522 395973 3320352 java.lang.StringBuffer
195982 335331 3148800 java.lang.Integer
144082 277954 3457968 com.webobjects.foundation.NSArray
139885 255724 5595400 com.webobjects.foundation.NSMutableArray
129388 207580 9315936 com.webobjects.eocontrol._EOMutableKnownKeyDictionary
123750 234451 2970088 java.lang.ref.WeakReference
79519 170383 4453064 com.webobjects.foundation.NSMutableDictionary
71734 72600 2869360 com.webobjects.foundation.NSTimestamp
63052 75908 2017664 com.webobjects.eoaccess.EOAccessGenericFaultHandler$_EOHandlerWeakRef
60841 102328 973456 java.util.regex.Pattern$Slice
60421 112258 966736 java.util.regex.Pattern$Dollar
60375 101567 966000 java.util.regex.Pattern$Begin
53924 106458 3019744 java.util.regex.Matcher
51772 51890 2485056 com.webobjects.eocontrol._EOCheapCopyMutableArray
50346 84241 805536 java.util.regex.Pattern$Branch
48027 51862 2305296 com.webobjects.eoaccess.EOAccessArrayFaultHandler
42591 51612 1362912 com.webobjects.eocontrol._EOIntegralKeyGlobalID
40967 62951 1638680 com.webobjects.foundation.NSMutableSet
40262 67612 966288 com.webobjects.foundation._NSWeakMutableCollection$_NSWeakMutableCollectionReferenceEnumerator
35508 35508 1420320 com.webobjects.eocontrol._EOWeakReference
30467 55375 731208 java.util.ArrayList
29864 60907 955648 java.sql.Timestamp
27818 27880 1479704 java.util.WeakHashMap$Entry
27469 27469 1098760 com.webobjects.eoaccess.EODatabase$_DatabaseRecord
23386 265470 658056 java.lang.Class
23067 71772 369072 java.lang.Boolean
22496 39471 719872 com.webobjects.foundation._NSCollectionEnumerator
20206 35317 484944 com.webobjects.foundation.NSNotification
20117 33609 3057784 com.mysql.jdbc.ResultSet
19158 33717 459792 com.webobjects.eocontrol.EOKeyValueQualifier
16800 30915 403200 com.webobjects.foundation._NSJavaArrayEnumerator
16728 49148 487840 java.util.HashMap$Entry
16474 35426 527168 com.webobjects.eoaccess.EODatabaseChannel$_EODatabaseChannelFetchResult
15025 24046 601000 com.webobjects.eoaccess.EOAccessFaultHandler
12396 20520 595008 com.webobjects.eocontrol.EOFetchSpecification
11350 18716 707320 java.lang.reflect.Constructor
10604 10650 254496 er.extensions.appserver.ERXApplication$JarChecker$Entry
10600 30458 678400 java.util.regex.Pattern
10208 143492 874648 java.lang.reflect.Method
10170 30908 565040 java.util.regex.Pattern$GroupHead
10115 29071 161840 java.util.regex.Pattern$Start
10066 17324 241584 java.util.AbstractList$Itr
10060 16797 241440 com.mysql.jdbc.DatabaseMetaData
10059 16798 724248 com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression
10059 16797 160944 com.webobjects.jdbcadaptor.JDBCFetchPrivate
10059 16794 2092272 com.mysql.jdbc.PreparedStatement
10059 16794 402360 com.mysql.jdbc.PreparedStatement$ParseInfo
10058 29080 241392 java.util.regex.Pattern$TreeInfo
10058 16804 241392 com.mysql.jdbc.RowDataStatic
10058 16797 190616 com.webobjects.eocontrol.EOEnterpriseObject
10058 16797 160928 com.mysql.jdbc.ResultSetMetaData
10058 16794 179248 java.io.InputStream
9105 9125 946920 wk.cheetah.eof.CTLocation
8480 18911 135680 java.lang.Double
7820 13230 125120 com.webobjects.eocontrol.EOOrQualifier
7604 215135 121664 java.lang.StringBuilder
7360 7360 176640 com.webobjects.eoaccess.EODatabase$_ToManyRecord
7300 7706 233624 java.math.BigDecimal
7199 7214 806288 wk.cheetah.eof.CTCustomer
5088 31155 169736 java.util.Hashtable$Entry
4690 4709 637840 wk.cheetah.eof.CTMediaTemplate
4428 567855 123280 com.webobjects.foundation.NSKeyValueCoding$_KeyBinding
4207 4699 305912 java.lang.reflect.Field
3764 3765 451680 wk.cheetah.eof.CTUser
3615 3615 375960 wk.cheetah.eof.CTAccount
3578 11151 85872 java.sql.Date
3425 3425 82200 wk.eofextensions.EncodedString
2783 2783 311696 wk.cheetah.eof.CTAddress