Java VM memory usage
From VuzeWiki
There are two basic types of memory in java:
1) heap memory, which is the standard memory pool, storing most everything, like objects.
2) direct memory, which is a faster form of memory, managed by our own pool, used for network and disk buffers in Az.
The two pools are mostly independent from each other in terms of real memory usage, but the direct memory pool is limited in size by default (under java 1.4.2_05 and 1.5 series) to the max heap size.
The heap size defaults to 64mb, but if you use the Azureus.exe launcher to run, it sets the min heap to 16mb and the max to 128mb. Thus, the heap size can vary dynamically.
To explicitly limit the maximum size of the VM heap, use the -Xmx command line option. For example, for a maximum heap size of 96 MB use -Xmx96m.
Memory usage debug output:
DIRECT: given=8452MB, returned=8434MB, in use=18MB, free=10MB HEAP: max=63MB, total=34MB, free=4MB
HEAP:max is the largest the heap is allowed to expand to
HEAP:total is the current heap size allocated, expandable to 'max' if needed
HEAP:free is how much of the 'total' is unused
DIRECT:given/returned is just a total of how many bytes are coming in and out of the pool
DIRECT:in_use is how much direct memory is allocated and in-use by Az
DIRECT:free is how much direct memory is sitting unused in the pool
So, real-world memory usage should be DIRECT:in_use + DIRECT:free + HEAP:total, with a few caveats: a) there's standard vm overhead b) "freed" direct memory is subject to os and vm garbage collection policy, and as such may take a while to be truly released back to the os.
[edit] Disk cache
The disk cache uses direct memory of course, so you don't want to set it greater than the direct mem limit (which defaults to HEAP:max, but is overrideable via the -XX:~MaxDirectMemorySize= command line option), or else you'll get those memory usage error alerts. With the disk cache, a little bit goes a long way, so 10 to 20 MB will probably do just fine (and you can check the cache hit rates in the stats view). Never use more than 32 MB cache.
Read the Azureus FAQ
