Are ratios between spaces/generations in the Java Heap constant?

I have read this article about virtual machine garbage collection tuning to understand the java garbage collector better. Each space has a Virtual heap space area which it can grow into as the heap space needed gets closer to the max heap size. This can be seen in this picture: Java GC arrangement of generations http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/190244.gif Y

Java堆中的空间/世代之间的比率是不变的?

我已经阅读了关于虚拟机垃圾收集调优的文章,以更好地理解Java垃圾收集器。 每个空间都有一个虚拟堆空间区域,随着堆空间需要更接近最大堆大小,它可以增长。 这可以在这张图中看到:世代的Java GC安排http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/190244.gif 您可以使用NewRatio参数设置Young Generation和Old(Tenured)Generation之间的比率,以及使用SurvivorRatio参数设置Eden Space和Surviv

size causes JVM cannot be started

We use java webstart on the client side for a java swing based aplication. Recently we have been experiencing a weird "Cannot start java Virtual machine " error when clicking in the jnlp link. We soon find out its because the max-heap-size setting in the jnlp file was set to 1024m whereas most of the clients PC only have 1 gb physical memory. Set the max-heap-size back to 512m solve

大小会导致JVM无法启动

我们在客户端使用java webstart来执行基于java swing的应用程序。 最近我们在点击jnlp链接时遇到了一个奇怪的“无法启动java虚拟机”错误。 我们很快就会发现它的原因,因为jnlp文件中的max-heap-size设置被设置为1024m,而大多数客户端PC只有1 gb物理内存。 将max-heap-size设置回512m解决了问题。 目前,jnlp文件中的相关行看起来像 <j2se version="1.5+" initial-heap-size="100m" max-heap-size="512m"/> 我研究

Maximum Java heap size of a 32

The question is not about the maximum heap size on a 32-bit OS, given that 32-bit OSes have a maximum addressable memory size of 4GB, and that the JVM's max heap size depends on how much contiguous free memory can be reserved. I'm more interested in knowing the maximum (both theoretical and practically achievable) heap size for a 32-bit JVM running in a 64-bit OS. Basically, I'm lo

最大Java堆大小为32

问题不在于32位操作系统上的最大堆大小,因为32位操作系统的最大可寻址内存大小为4GB,并且JVM的最大堆大小取决于可以保留多少连续空闲内存。 我更感兴趣的是了解在64位操作系统中运行的32位JVM的最大(理论和实际可行)堆大小。 基本上,我正在寻找类似SO的相关问题中的数字的答案。 至于为什么使用32位JVM而不是64位JVM,原因不是技术性的,而是管理/官僚性 - 在生产环境中安装64位JVM可能已经太晚了。 希望有一大块内

Where will the object be created in java

This question already has an answer here: Where are static methods and static variables stored in Java? 7 answers For the Oracle JVM, there is a special object for each class to hold it's static fields. You can see this special object if you do a heap dump. NOTE: There is no specification of where static members are stored, so it could be anywhere based on the JVM.

在java中将创建对象的位置

这个问题在这里已经有了答案: 在Java中存储静态方法和静态变量在哪里? 7个答案 对于Oracle JVM,每个类都有一个特殊的对象来保存它的静态字段。 如果你做堆转储,你可以看到这个特殊的对象。 注:没有指定存储静态成员的位置,因此它可以基于JVM的任何位置。

Permgen is part of heap or not?

I have found picture from official oracle site but in popular SO answer I have found that permanent generation is not part of heap Permanent Generation (non-heap): The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. I messed wit

Permgen是否是堆的一部分?

我从官方oracle网站上找到了图片 但在流行的答案中,我发现永久代不是堆的一部分 永久生成(非堆):包含虚拟机本身的所有反射数据(例如类和方法对象)的池。 对于使用类数据共享的Java虚拟机,这一代分为只读和读写区域。 我搞砸了这些矛盾的数据。 我相信这两个地方的数据都是有效的,但有保留。 请为我澄清这个问题。 PS 让我们只讲Sun / Oracle jvms。 PS2 我已经阅读了jvm gcs(serial,parallel,cms和g

When is the memory allocated for a static variable in java?

All the objects of a class share the static variable. But when is the memory allocated for the static variable? Is it when the first object is created for the class? Or does it happen even before any instance for the class is created? Also instance variable is allocated memory at runtime. The memory for static variable is allocated at runtime or compile time? When the class is loaded, at r

什么时候在java中为静态变量分配内存?

一个类的所有对象共享静态变量。 但是什么时候分配给静态变量的内存呢? 第一个对象是为该类创建的吗? 或者甚至在创建类的任何实例之前发生? 实例变量也在运行时分配内存。 静态变量的内存是在运行时还是编译时分配的? 在运行时加载类时。 你可以在这里找到细节。 当类加载器加载类时,所有静态变量的memeory将被分配,并且只会完成一次

Do static members help memory efficiency?

If I have a class that I expect to be used in thousands of instances in a memory-sensitive application, does it help if I factor out static functionality to static members? I imagine that static methods and variables are stored once per class while for non-static members there has to be something stored for each instance. With member variables, it seems quite clear, but what kind of data is s

静态成员是否有助于记忆效率?

如果我有一个类,我希望在一个内存敏感的应用程序中使用数千个实例,如果我将静态功能列入静态成员,是否有帮助? 我认为静态方法和变量每个类存储一次,而对于非静态成员则必须为每个实例存储一些内容。 对于成员变量,似乎很清楚,但是为方法存储了哪种数据? 我正在使用Java,但我想象一些通用规则也适用于其他托管环境(如.NET)。 静态方法和幕后非静态(实例)方法之间唯一的区别是一个额外的隐藏参数( this )被

Where are static variables stored in java?

This question already has an answer here: Where are static methods and static variables stored in Java? 7 answers Method Area and PermGen 4 answers In the JVM memory model the reference to and value of static variables are both stored in the method area which itself is in the heap. The method area is created on virtual machine start-up. Although the method area is logically part of the

在java中存储静态变量的位置?

这个问题在这里已经有了答案: 在Java中存储静态方法和静态变量在哪里? 7个答案 方法区和PermGen 4个答案 在JVM内存模型中,静态变量的引用和值都存储在本身位于堆中的方法区域中。 方法区域是在虚拟机启动时创建的。 虽然方法区域在逻辑上是堆的一部分,但是简单的实现可以选择不垃圾收集或压缩它。 https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.5.4 来自JVM文档: 方法区域 Jav

Question about local final variable in Java

I have the following code: public class BookLib { void f() { final int x = 5; // Line 1 class MyCLass { void print() { System.out.println(x); } } } } I don't understand why should use final variable in this case (Line 1)? You've created an inner class here. Since the life-time of objects of this class can potenti

有关Java中本地最终变量的问题

我有以下代码: public class BookLib { void f() { final int x = 5; // Line 1 class MyCLass { void print() { System.out.println(x); } } } } 我不明白为什么要在这种情况下使用final变量(第1行)? 你在这里创建了一个内部类。 由于此类的对象的生命周期可能远远大于方法调用的运行时间(即对象在方法返回后仍可能存在很长时间),因此它

How does Java manager the memory?

I'm trying to discover how Java manages memory. I'm learning which part of memory holds static methods and static variables. They said PermGen memory holds static variables and static methods, which is a part of non-heap memory(picture below). But, from what I've learnt, Java has stack segment to hold local variables, parameters, references, values of non-void function returns...

Java如何管理内存?

我试图发现Java如何管理内存。 我正在学习内存的哪个部分保存静态方法和静态变量。 他们说PermGen内存保存静态变量和静态方法,这是非堆内存的一部分(下图)。 但是,从我所了解到的情况来看,Java有堆栈段来存放局部变量,参数,引用,非void函数返回值等等,堆段包含对象和数组。 我已经阅读了许多关于这个主题的许多问答,并且有两种方式来解释它: 分为2部分:堆和非堆内存。 分为3部分:堆栈段,堆段,代码段。