"Memory Leak" is the term used when the application you are running runs out of memory. This could be beacuse of following reasons:
1) Your application is big and you have not allocated enough memory(heap memory) for it.
2) You might have allocated sufficient memory for your application but there is not enough native memory (memory used by OS) for its internal functioning.
If you are running a java application and if it is falling short of memory( heap memory) it may throw the following error "java.lang.OutOfMemoryError" which means that there is a memory leak.
One way to produce "Memory Leak" is to Endurance Test your application. Run a test with maximum number of users for an long period of time. What happens here is that the java heap gets full and there is no more space for incoming objects.Hence the error.
Any application requires some memory to run. If we consider a java application then during its lifetime, many java objects are created and then garbage collected. For storing these objects, we require a section of physical memory which is called "Heap Memory".
We specify the amount of heap memory by specifying the JVM arguments -Xms and -Xmx.
I think the numbers provided by Siddiq are not proper. This is not the case always. If we consider a 32bit machine (Linux or windows) then the maximum heap we can practically allocate to JVM is ~1.5 GB. This is a limitation of 32 bit machine.
So if you have 8 Gigs of RAM, according to your figures, 4 Gigs you can allocate as JVM Heap, which is never possible. So please re-consider the figures that you stated.
For 64 bit machine you can have as much heap as you want.
How you allocate or deallocate using JVM is code level. I am referring to HARDWARE memory.
The % were w.r.t 32 bit processor not 64-128 bit.
If you have 8 GB RAM, what is the RAM configuration can you guide us? Why is it not possible to have 4GB Heap?? What happens to left out HEAP IF you practically allocate only 1.5 GB as your JVM HEAP?
what i replied was in context to the question posted by Hitesh. It was regarding "Memory Leak" which we can relate to when an application is running.You cannot get memory leak error as it is.
And for more clarity, I gave an example of java application and hence JVM heap size.
Regarding why we cannot allocate more heap to JVM in 32 bit machine, that is its limitation.
If you have 8 GB RAM, what is the RAM configuration can you guide us? Why is it not possible to have 4GB Heap?? What happens to left out HEAP IF you practically allocate only 1.5 GB as your JVM HEAP?
When you run an application, at that time so many processes are started and initially each process use some amount of virtual memory. If you run the application for long time or continuously modify your application settings the virtual memory size of your process may increase and that is called the "memory leak".
To check the memory leak, initially take the snapshot of the memory usage used by the processes. After run your application for long time and then take the memory usage snapshot again. Now compare with old one. If memory has been increased then there is memory leak in your application. Otherwise your application is working fine.