Sun

How to query the memory usage stats from the JVM

People using Hibernate and Sun's JVM usually face the java.lang.OutOfMemoryError: PermGen space message sooner or later (mostly sooner Smiling ). To track down the source of an OutOfMemoryError problem you've to be able to query the amount of total and free memory within each available memory pool (heap and non-heap pools as well). Here's a short code snippet to demonstrate how to do that ...

Strange behaviour in Java compilers' string concatenation (caused by compile-time constants)

I'm sure thousands have stumbled on this before me, but still, it's weird and I cannot explain why it works as it works. Shocked At first glance it appeared that if you define a variable in a public class as public static final (ie. a constant) and the variable has a primitive type, then other classes referencing this variable will somehow "cache" the variable value in their own .class file. Looking deeper into the problem I've discovered that the situation is not as bad as I feared: I just crossed javac compiler's string concatenation optimization and it seems it does a bit "too much" for my taste.
Update: Jeff provided a reference to sections of the Java Language Specification that explain why and how this is working. The relevant term is: compile-time constants.

Funny thing - is RSA banned by Sun?

I've just gone through the Java Cryptography Extension 1.2.2 API Specification & Reference document to read some examples on use of JCE. I want to use RSA encryption and in Java JCE is the way to go. However the JCE examples in the above doc do not even mention RSA! They tell about DES, DESede (Triple DES), Blowfish, but no word on RSA. This is quite strange, isn't it? Shocked

Found my first bug in the new Parallels Desktop

Sun's JRE does not work in the new Parallels Desktop release with the DirectX support enabled. It seems the DirectX support is not disabled by accident in the default virtual machine config. Smiling Parallels was quite in a hurry bringing out their new release. I suppose the new DirectX features have still quite some bugs. However I'm pretty much disappointed with Sun's JRE. At least the "Control Panel" should work without any DirectX support and if some features of JRE depend on DirectX, then one should have the chance to enable/disable them.

Syndicate content