All of lore.kernel.org
 help / color / mirror / Atom feed
* Linux free issue
@ 2003-07-19 13:34 Vinay I K
  2003-07-19 14:39 ` Rik van Riel
  0 siblings, 1 reply; 4+ messages in thread
From: Vinay I K @ 2003-07-19 13:34 UTC (permalink / raw)
  To: Linux-MM

Hello,

Its a newbie question. I have been trying to look around and hit upon the following link.      
http://mail.nl.linux.org/linux-mm/1998-08/msg00028.html

I am a bit confused. When we call free in Linux, is the memory not given back to the system(just cached)? What is the state of the issue in the latest Linux Kernel?

Thanks,
Vishwas


____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linux free issue
  2003-07-19 13:34 Linux free issue Vinay I K
@ 2003-07-19 14:39 ` Rik van Riel
  2003-07-20  2:27   ` Eugene Teo
  0 siblings, 1 reply; 4+ messages in thread
From: Rik van Riel @ 2003-07-19 14:39 UTC (permalink / raw)
  To: Vinay I K; +Cc: Linux-MM

On Sat, 19 Jul 2003, Vinay I K wrote:

> http://mail.nl.linux.org/linux-mm/1998-08/msg00028.html
> 
> I am a bit confused. When we call free in Linux, is the memory not given
> back to the system(just cached)? What is the state of the issue in the
> latest Linux Kernel?

The issue is not in the Linux kernel at all, but in glibc.
It is the C library that has (after careful measuring and
optimising) made the decision to not call the system call
to free memory but instead keep it for later use.

I suspect their decision is the right one in most of the
cases.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linux free issue
  2003-07-19 14:39 ` Rik van Riel
@ 2003-07-20  2:27   ` Eugene Teo
  0 siblings, 0 replies; 4+ messages in thread
From: Eugene Teo @ 2003-07-20  2:27 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Vinay I K, Linux-MM

<quote sender="Rik van Riel">
> On Sat, 19 Jul 2003, Vinay I K wrote:
> 
> > http://mail.nl.linux.org/linux-mm/1998-08/msg00028.html
> > 
> > I am a bit confused. When we call free in Linux, is the memory not given
> > back to the system(just cached)? What is the state of the issue in the
> > latest Linux Kernel?
> 
> The issue is not in the Linux kernel at all, but in glibc.
> It is the C library that has (after careful measuring and
> optimising) made the decision to not call the system call
> to free memory but instead keep it for later use.

I agree with Riel. It has nothing to do with the kernel,
but the implementation of the dynamic memory allocator
in the userspace C library.

The actual implementation might differ a little but the
general idea is that whenever you do a free, it deallocates
the region of memory by storing this "freed" space to a free
list. You will notice that the heap offset is not decreased
by using the sbrk syscall. The next time you call malloc,
it will search through the free list, and if a space matches,
that spaces will be used to your program. Otherwise, it will
increase the heap, allocate a region of memory you specified 
for your program instead.

Eugene

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Linux free issue
@ 2003-07-19 13:35 Vinay I K
  0 siblings, 0 replies; 4+ messages in thread
From: Vinay I K @ 2003-07-19 13:35 UTC (permalink / raw)
  To: Linux-MM

Hello,

Its a newbie question. I have been trying to look around and hit upon the following link.      
http://mail.nl.linux.org/linux-mm/1998-08/msg00028.html

I am a bit confused. When we call free in Linux, is the memory not given back to the system(just cached)? What is the state of the issue in the latest Linux Kernel?

Thanks,
V


____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-20  2:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-19 13:34 Linux free issue Vinay I K
2003-07-19 14:39 ` Rik van Riel
2003-07-20  2:27   ` Eugene Teo
2003-07-19 13:35 Vinay I K

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.