`

Memory usage of Java

    博客分类:
  • JAVA
 
阅读更多

用JDK自带的api计算size,每次都会有个多余的12,看了这些文档终于知道了

 

1:Memory usage of Java Strings and string-related objects

http://www.javamex.com/tutorials/memory/string_memory_usage.shtml

 

 

2:Memory usage of Java objects: general guide

http://www.javamex.com/tutorials/memory/object_memory_usage.shtml

 

 

How to calculate the memory usage of a Java array

http://www.javamex.com/tutorials/memory/array_memory_usage.shtml

 

 

4:Memory usage of Java Strings and string-related objects

http://www.javamex.com/tutorials/memory/string_buffer_memory_usage.shtml

分享到:
评论
2 楼 vavi 2012-10-08  
啊 明白我错在哪里了 
1 楼 vavi 2012-10-07  
请教个问题,String内存大小是如何计算的?
multiply the number of characters of the String by two;
add 38;
if the result is not a multiple of 8, round up to the next multiple of 8;
the result is generally the minimum number of bytes taken up on the heap by the String.
我只能这样算: ojbect head  为 8 bytes
            3个 int       为 3*4 = 12 bytes
            1个char[]     为 12
不考虑char[]大小的话,为 8+12+12=32 bytes(不是38个字节), 还有6个字节那里去了??

相关推荐

    jvm-nmt-tracing-master.zip

    Tracing the internal memory usage of Java Virtual Machine (JVM) by Native Memory Tracking (NMT)

    Android代码-查看手机应用的CPU和内存资源的使用情况

    AnotherMonitor monitors and records the CPU and memory usage of Android devices. Download ready-to-use app The app is released on Google Play: ...

    Oracle WebLogic Server 10gR3: Troubleshooting Methodologies

    Review of General Memory Concepts: Java Heap, Native Memory, and Memory Leaks Investigating Java Heap Out of Memory Errors Review Garbage Collection and Object References Symptoms, Causes, and ...

    Problem Solving in Data Structures & Algorithms Using Java 2nd Edition

    Problem Solving in Data Structures & Algorithms” is a series of books about the usage of Data Structures and Algorithms in computer programming. The book is easy to follow and is written for ...

    java在cpu的占有率

    System.out.println("Get usage rate of CUP , linux version: " + linuxVersion); Process process = Runtime.getRuntime().exec("top -b -n 1"); is = process.getInputStream(); isr = new ...

    Problem Solving in Data Structures & Algorithms Using Java, 2nd Edition

    “Problem Solving in Data Structures & Algorithms” is a series of books about the usage of Data Structures and Algorithms in computer programming. The book is easy to follow and is written for ...

    javacv-platform-1.3.3-src

    JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of computer vision (OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, librealsense, CL PS3 Eye...

    Object-relative Addressing - Compressed Pointers in 64-bit Java Virtual Machines (P107_134)-计算机科学

    much memory as 32-bit address spaces, resulting in increased memory usage.This paper reduces the memory usage of 64-bit pointers in the context of Java virtual machines through pointer compression, ...

    亚信java笔试题-FE:前端资源收集

    亚信java笔试题 ##说说你对闭包的理解 ##Talk about your understanding of closures 使用闭包主要是为了设计私有的方法和变量。闭包的优点是可以避免全局变量的污染,缺点是闭包会常驻内存,会增大内存使用量,使用...

    hive on tez 常见报错问题收集

    3)Current usage: 1.0 GB of 1 GB physical memory used;2.7 GB of 2.1 GB virtual memory used. Killing container 4)java.lang.RuntimeException: java.lang.RuntimeException: Hive Runtime Error while ...

    clucene源码

    Memory in CLucene has been a bit of a difficult thing to manage because of the unclear specification about who owns what memory. This was mostly a result of CLucene's java-esque coding style that was ...

    操作系统(内存管理)

    /* Begin searching at the start of managed memory */ current_location = managed_memory_start; /* Keep going until we have searched all allocated space */ while(current_location != last_valid_...

    Professional Hadoop

    Configure storage, UE, and in-memory computing Integrate Hadoop with other programs including Kafka and Storm Master the fundamentals of Apache Big Top and Ignite Build robust data security with ...

    eMMC5.0Spec_JESD84-B50@www.java1234.com.pdf

    The e•MMC is a managed memory capable of storing code and data. It is specifically designed for mobile devices. The e•MMC is intended to offer the performance and features required by mobile devices...

    Geoserver Beginner`s Guide

    Memory Usage 58 JVM Version and fonts 58 JAI usage and configurations 58 Update Sequence 58 Resource Cache 59 Configuration and catalog 59 GeoServer Logs 59 Contact Information 59 About 60 Time for ...

    XDA成员开发出Carrier IQ检测程序(Android)

    Screenshots of a "fail condition" Shows on stock rom regardless of tell HTC or location setting logging is enabled and running, proving HTCs statement wrong, wasting resources, io, memory, bandwidth ...

Global site tag (gtag.js) - Google Analytics