Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes Difference b/w Heap and Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference b/w Heap and Pool" Watch "Difference b/w Heap and Pool" New topic

Difference b/w Heap and Pool

Noorulain Khan

Joined: Jul 31, 2001
Posts: 28
Could any one can explain that what are heap and pool and difference between them
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Thius has been discussed several times. use the search facility to search this forum for those keywords.


So much trouble in the world -- Bob Marley
Noorulain Khan

Joined: Jul 31, 2001
Posts: 28
Thanks for your reply. But I couldnt find any search section in this site.
Sadaf Zaidi

Joined: Oct 09, 2001
Posts: 29
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
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 it helps.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Look at the top of this page. Under the "post Reply" button are some links. One of them is the search facility.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Noorulain Khan

Joined: Jul 31, 2001
Posts: 28
Thanks so much Cindy. It is now clear on me.
I agree. Here's the link:
subject: Difference b/w Heap and Pool
It's not a secret anymore!