Re: Memory utilization

Johan Stuyts <[email protected]> Wed, 30 Jan 2008 09:52:31 +0100
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <op.t5qixtzcc4vsc3@audioslave>
> I set my max and min heap size to be 1GB. I find that the program dies  
> after having created 4M entries (at which point the heap used is at 1GB)  
> although the memory used by the objects as indicated by the Netbeans  
> memory profiler is the following:
>
> String -- 48MB
> char[] -- 48 MB
> HeapCharBuffer -- 45MB
> Integer -- 19MB
> HashMap$Entry -- 19MB

These numbers cannot be right. You have 4 million hash map entries which  
in total use 19 MB of memory. That is 5 bytes per entry which is way too  
low. The space needed for its members is 16 bytes (assuming a 32-bit JVM).  
In addition you have the standard object overhead which is usually 8-12  
bytes. So the amount of memory used by the entries must be at least 4  
million times 24 = 96 MB.

Try to get to the highest possible number of entries without causing an  
exception, and then measure again.

Johan Stuyts

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com