gpt4 book ai didi

Java应用程序对象...它存储在哪里?

转载 作者:行者123 更新时间:2023-12-02 00:55:26 24 4
gpt4 key购买 nike

我正在考虑使用java应用程序对象来实现一个简单的缓存,保存一些配置变量,以及一些包含常用信息的xml...

我想知道应用程序数据的物理存储位置(系统文件、内存、数据库),如何配置它,以及是否有任何类型的限制,如空间、并发等...

此外,对于可扩展性(大小和并发性)的任何其他担忧,我们将不胜感激......

如果有人能给我指出一些地方来查找更多信息,我将非常高兴......

非常感谢

最佳答案

对象存储在堆中。堆空间可以通过VM的配置文件进行管理。

A constructor call is more complicated than an ordinary subroutine or function call. It is helpful to understand the exact steps that the computer goes through to execute a constructor call:

  1. First, the computer gets a block of unused memory in the heap, large enough to hold an object of the specified type.
  2. It initializes the instance variables of the object. If the declaration of an instance variable specifies an initial value, then that value is computed and stored in the instance variable. Otherwise, the default initial value is used.
  3. The actual parameters in the constructor, if any, are evaluated, and the values are assigned to the formal parameters of the constructor.
  4. The statements in the body of the constructor, if any, are executed.
  5. A reference to the object is returned as the value of the constructor call.

The end result of this is that you have a reference to a newly constructed object. You can use this reference to get at the instance variables in that object or to call its instance methods.

http://www.faqs.org/docs/javap/c5/s2.html

以下是一些虚拟机配置参数

http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp

我曾经为 xml 对象编写过一个缓存(以某种方式调用它们)。带有字符串键(文件名)和对对象(已解析的 xml 文件)的引用的 Map 就足够了。除此之外,缓存是单例的(同步的)。对缓存编译的 JasperReports 也做了同样的事情(我在这里得到了明显的速度提升,因为报告不再每次都编译)

关于Java应用程序对象...它存储在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/832796/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com