background preloader

Java

Facebook Twitter

Java SE 6 Performance White Paper. The J2EE(TM) 1.4 Tutorial. Sizeof for Java. December 26, 2003 Q: Does Java have an operator like sizeof() in C? A: A superficial answer is that Java does not provide anything like C's sizeof(). However, let's consider why a Java programmer might occasionally want it. A C programmer manages most datastructure memory allocations himself, and sizeof() is indispensable for knowing memory block sizes to allocate. By comparison, Java object allocation and construction are tied together (it is impossible to use an allocated but uninitialized object instance). Of course, this works only for simple Java applications. Before proceeding, I will dispense with some frequent but incorrect answers to this article's question. Fallacy: Sizeof() is not needed because Java basic types' sizes are fixed Yes, a Java int is 32 bits in all JVMs and on all platforms, but this is only a language specification requirement for the programmer-perceivable width of this data type.

Another working approach What is an object's size? Desktop Java Features in Java SE 6. Oracle Technology Network > Java Software Downloads View All Downloads Top Downloads New Downloads What's New Java in the Cloud: Rapidly develop and deploy Java business applications in the cloud.

Essential Links Developer Spotlight Java EE—the Most Lightweight Enterprise Framework? Blogs Technologies Contact Us About Oracle Cloud Events Top Actions News Key Topics Oracle Integrated Cloud Applications & Platform Services. Butterfly Container. Jdk6: Java SE 6. Java Image I/O API Guide.