how to find out how many memory is used for NIO

is there any way to find out how many memory is used for nio in a virtual machine. ?

I know that is possible to find out how many total, free and used memory the heap has by using java.lang.Runtime#totalMemory...

We sometimes expect errors that it is not possible to create any more connections because of the NIO memory size but the heap is still ok. Today we had an error where 170mbytes of heap where left but it was not possible to create new tcp connections because of an exception:

javax.naming.NamingException: java.net.SocketException: No buffer space available (maximum connections reached?): connect

The number of TCP-Connections was ok (<500).

It would be very nice if someone knows how to find out how the amount of memory that NIO buffers use can be determined within Java 1.4.

best regards

benjamin

[867 byte] By [deep-creeka] at [2007-10-2 23:09:26]
# 1
This sounds like a bug in 1.4, Are you using the latest version of 1.4.2_11 or whatever it is up to now.
Peter__Lawreya at 2007-7-14 6:23:21 > top of Java-index,Desktop,Runtime Environment...
# 2

We have to use 1.4.2_03. This is because of the special environment we are running on.

We did also figured out that there are some NIO Memory Bugs but we since we are not allowed to upgrade the used Virtual Machine we have to live with these errors.

The problem that we currently have is within a Server and because of this circumstance we are trying to find a workaround or way to find out how many memory is allocated. If we would know how to get this value we could restart the servers as a workaround after the value reaches a threshold.

We are also very sad that we can`t easily upgrade/update to the latest 1.4.2 Version or the newest 1.5 to get rid of these NIO Bugs!

deep-creeka at 2007-7-14 6:23:21 > top of Java-index,Desktop,Runtime Environment...