File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Heap & Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Heap & Pool" Watch "Heap & Pool" New topic
Author

Heap & Pool

Noorulain Khan
Greenhorn

Joined: Jul 31, 2001
Posts: 28
What is the difference between heap and pool.
and use of intern() method
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The heap is just the area of RAM that is allotted to the JVM by the operating system for runtime activity. As such it is the place that objects get created during a JVM session.
From the Java Virtual Machine Specification

3.5.5 Runtime Constant Pool
A runtime constant pool is a per-class or per-interface runtime representation of the constant_pool table in a class file (�4.4). It contains several kinds of constants, ranging from numeric literals known at compile time to method and field references that must be resolved at run time. The runtime constant pool serves a function similar to that of a symbol table for a conventional programming language, although it contains a wider range of data than a typical symbol table.
Each runtime constant pool is allocated from the Java virtual machine's method area (�3.5.4). The runtime constant pool for a class or interface is constructed when the class or interface is created (�5.3) by the Java virtual machine.
The following exceptional condition is associated with the construction of the runtime constant pool for a class or interface:
When creating a class or interface, if the construction of the runtime constant pool requires more memory than can be made available in the method area of the
Java virtual machine, the Java virtual machine throws an OutOfMemoryError.
See Chapter 5 for information about the construction of the runtime constant pool.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
can any one define pool in its own words please!
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Sadaf,
The 'pool' is just a special area of memory that Java sets up to store all String literals. Imagine a box with a partition wall; on one side is the 'pool' on the other side the 'heap'. Everytime you use a string literal, it gets stored on the pool side, regular objects get stored on the heap side.
Hope that helps.


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Michael Bruesch
Ranch Hand

Joined: Sep 23, 2001
Posts: 158
Cindy Glass rocks! I've never learned so much quality information until I came across the posts of Cindy. They always answer the question and even go a step further. On behalf of everyone else here I'm sure, I thank you Cindy.


Michael J Bruesch<br /><i>I code, therefore I am.</i>
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You're welcome < Cindy bashfully shuffling feet >
Argm Mastoi
Ranch Hand

Joined: Oct 16, 2001
Posts: 35
yes thanx alot cindy, it is crystal clear now. how we can give smilies.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
See the link on the left to "Smilies Legend" when you post something.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Heap & Pool
 
Similar Threads
String pool
String pool question
Question on Object Reference tutorial created by Ankit
Help me
String pooling and garbage collector