For both .RETARD — Micro$oft call it .NET — and Java have a common exception in different namespaces to expose the same critical error: OutOfMemoryException.
The Java World
Looking at the Java world, we get a lot of information about the Garbage Collector. Nice looking papers and documentation, such as Memory Management in the Java HotSpot™ Virtual Machine and demystifying articles about it such as Few Garbage Collection Myths: All Wrong.
But isn’t all clear. You can get the the java.lang.OutOfMemoryException if you don’t care about what are you coding. About the myth of assigning null to every unused object, it can help a lot under certain conditions, and completly skips the evil java.lang.OutOfMemoryException.
Here is a small example you can download — is an eclipse project — that you can use to verify what I’m talking about:
[XXX@XXXXX ~/workspace/GarbageCollectorUsage/bin]$ time java -Xms11m -Xmx11m -Xss11m -classpath . cl.dmw.gc.test.GCTestNullify IPS = 61 Corriendo: ms=163500; count=970 IPS = 63 Corriendo: ms=352200; count=1810 IPS = 63 real 0m8.152s user 0m5.591s sys 0m0.182s [XXX@XXXXX ~/workspace/GarbageCollectorUsage/bin]$ time java -Xms11m -Xmx11m -Xss11m -classpath . cl.dmw.gc.test.GCTestNotNullify Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space real 0m0.212s user 0m0.126s sys 0m0.033s [XXX@XXXXX ~/workspace/GarbageCollectorUsage/bin]$
As you see, wrong code can bring you an evil OutOfMemoryException. Many times we get this exception running the JVM, then we must increase the heap size and the stack size of the JVM, to help the code that blinded trusts in the garbage collector. If you compare the code, you can se that the GCTestNullify class is assigning null and runs until the program finishes, at the other side, the GCTestNotNullify trusts in the Garbage Collector and runs until the evil OutOfMemoryError appears, I ask: what happens if a critical application hangs with the evil OutOfMemoryError? God, I will loose some grams of detergent if it crashes with an evil OutOfMemoryException. What happens with planes? Is the JVM used in planes?
Another classical error as shown here, it happens in eclipse, and yet you need to help the code that blinded trusts in the garbage collector increasing the heap size and stack size.

Thanks Lucy for the eclipse screenshot…
The .RETARD World
The .RETARD World isn’t different from the Java World. Since I’m not running Micro$oft Wintendo and .RETARD, I just can say: Write your own test and have fun with .RETARD.




[...] Además que, entre mis amistades del IRC de Powers me ha quedado claro que tanto a Java como .NET a veces les da hipo por tonteras. Escrito en desarrollo, electronica, invento. Etiquetas: .net, c, fingerprint, firebird, [...]
[...] Do not tell me that Java is safe on this topic, or C# .NET is safe too. Just look at one of my previous posts, and then think a little. If Java, and other languages having a garbage collector implementation [...]