- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the differences between the Heap memory and the String Constant Pool in Java?
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.
Advertisements