---
title: "Memory usage of Java"
author: "dikar"
date: "2012-10-01T17:30:51Z"
tags: []
categories: ["开源软件"]
slug: "memory-usage-of-java"
draft: false
lastmod: "2012-10-01T17:30:51Z"
id: 1689084
url: "https://dikar.iteye.com/blog/1689084"
---

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

 

1：Memory usage of Java `String`s and string-related objects

[http://www.javamex.com/tutorials/memory/string\_memory\_usage.shtml](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](http://www.javamex.com/tutorials/memory/object_memory_usage.shtml)

 

 

3 How to calculate the memory usage of a Java array

[http://www.javamex.com/tutorials/memory/array\_memory\_usage.shtml](http://www.javamex.com/tutorials/memory/array_memory_usage.shtml)

 

 

4：Memory usage of Java `String`s and string-related objects

[http://www.javamex.com/tutorials/memory/string\_buffer\_memory\_usage.shtml](http://www.javamex.com/tutorials/memory/string_buffer_memory_usage.shtml)