Java performance Issues (II) - Memory
30 January 2008Java program requires more memory resources and is slow when compared with most of the natively compiled modern day programming languages such as C or C++. This is becuase the Java Library must be loaded in to memory before program execution takes place. In addition to that, both the Java binary and native recompilations must be in the memeory at the same time. Further, Java Virtual Machine (JVM) also requires memory recources for it self. These all add and Java memory usage is high when comapred to C, C++ etc.
Java has its own memory maangement. However, in certain situations memory must be released explicitely as it is done in C++. For example, in JDBC database connections you need to release the memory. In short, Java does not manage all resources for memory.
To avoid allocation errors such as memory leaks, Java (also) has garbage collection. As a result, in a way, in Java memory management is automatic.
In C++, programmers are allowed to control where objects are stored. This facilty is not available in Java which always allocates objects on heap. Only compiler can optimize this.
Related Posts:
- Java performance Issues (III) - Garbage collection
- Java performance Issues (IV) - Hardware interfacing
- Tunning Eclipse
- Java built-in data types (performance issues)
- Performance Issues (adding element to a Vector)
- Java IO tasks
- Java performance Issues (I)
- Vector Capacity
- Performance issues related to trigonometric functions , floating point arithmetic and JNI (I)
- Performance Issues (String Concatenation)
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Java performance Issues (II) - Memory