Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Performance and the fly likes Difference between Heap memory size and RAM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Difference between Heap memory size and RAM" Watch "Difference between Heap memory size and RAM" New topic
Author

Difference between Heap memory size and RAM

Lara Martin
Greenhorn

Joined: Feb 06, 2002
Posts: 23
What is the difference between RAM and Heap memory size?How the heap memory size relates to System RAM?
Thanks
Lara
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Lara Martin:
What is the difference between RAM and Heap memory size?How the heap memory size relates to System RAM?
Thanks
Lara

The RAM is the physical memory of your computer. Heap memory is the (logical) memory reserved for the heap.
So, only part of the RAM is used as heap memory and heap memory doesn't have to be fully loaded into RAM (e.g. part of it may be swapped to disc by the OS).
Does that help? Why do you want to know?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Lara Martin
Greenhorn

Joined: Feb 06, 2002
Posts: 23
Thanks...
What is swapped to OS?
I use WebLogic server 6.1 and some heap memory size in startWebLogic.sh file.Just want to know the differences.
Lara
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
It's a question of OS paging, aka virtual memory. You computer can take some of the data in RAM and write it to disk, temporarily. (This is, of course, the data the OS has determined will be least needed in the near future.) The data paged out could be your application data, or even parts of the application itself, or simply other applications in their data, which are running in the backgroun.
--Mark
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Originally posted by Mark Herschberg:
(This is, of course, the data the OS has determined will be least needed in the near future.)

Mark, is it sure that OS will replace the data which will least needed in the near future?.
As far as i know it depends upon the OS that which paging algorithm it is using.It may be,
1:Least Recent Used
2:Least Frequently Used
3 ptimal Page Replacement
Bye,
Viki.
[ June 07, 2002: Message edited by: Vikrama Sanjeeva ]

Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Certainly the OS cannot know what will really be needed in the future - it can only guess. When Mark says "the data the OS has determined will be least needed in the near future", he means "the data the OS thinks will be least needed in the near future". No big deal.


"I'm not back." - Bill Harding, Twister
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Originally posted by Jim Yingst:
Certainly the OS cannot know what will really be needed in the future - it can only guess.

My point is not that, what OS will guess about which data should be placed temporarily to disk.
As Mark in his last post said,

It's a question of OS paging, aka virtual memory. You computer can take some of the data in RAM and write it to disk, temporarily. (This is, of course, the data the OS has determined will be least needed in the near future.)

In the BOLD lines above in his quote,He sures that OS will be using Least Frequently Used
Algorithm.Well as far as i know it depends which data OS will place temporarily in disk.It may place,
1: The data which is used just recently.
2: The data which will be not used frequently(in future)
3: The data which is used heavily.
Bye,
Viki.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
My statement does not imply that LFU is used by the OS. There are hundreds of caching and paging algorithms that have been developed.
Here's an example let's say that some system data is used once every 5 seconds. In the last 4 second some application data was produced and used, but the way the program works, the application data will not be needed for a while longer, e.g. 30 seconds. The system data, used every 5 seconds, was used less recently then the other data, but a sophisticated paging alogirthm will know not to page it out.
--Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Heap memory size and RAM