the differences between the Heap memory and the String Constant Pool

Heap Memory

  • The heap memory is a run time data area from which the memory for all java class instances and arrays is allocated.
  • The heap is created when the JVM starts up and may increase or decrease in size while the application runs.
  • The size of the heap can be specified using –Xms VM option. The heap can be of fixed size or variable size depending on the garbage collection strategy. Maximum heap size can be set using –Xmx option.
  • By default, the maximum heap size is set to 64 MB. 

String Constant Pool

  • String uses a special memory location to reuse of String objects called String Constant Pool.
  • String objects created without the use of new keyword are stored in the String Constant Pool part of the heap.
  • One of the important characteristics of String constant pool is that it does not create the same String object if there is already String constant in the pool.

 

Source:

https://www.tutorialspoint.com/what-are-the-differences-between-the-heap-memory-and-the-string-constant-pool-in-java

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值