Re: Memory cleanup



On Mon, 23 Apr 2001, David Given wrote:

I have a gtk  application that serves as a GUI for a data handling

snip...

but shouldn't all that memory be destroyed/reclaimed/made free by the
kernel after I exit those calls? BTW, the variables are declared local
to the function not global to the program.

The answer to your question is: not necessarily.

AFAIK, on most Unices application memory can't be returned to the kernel except
under certain limited conditions (you can only move the top-of-memory pointer
up and down with the brk() or sbrk() system call). It's sufficiently hard that
glibc doesn't bother.

snip...

You can alos try FreeBSD memory allocator

----

DEBUGGING MALLOC PROBLEMS
 The major difference between this implementation and other allocation  im-
 plementations is that the free pages are not accessed unless allocated,
 and are aggressively returned to the kernel for reuse.

---


http://www.FreeBSD.org/cgi/man.cgi?query=malloc&apropos=0&sektion=0&manpath=FreeBSD+4.2-RELEASE&format=html

and

http://www.FreeBSD.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/malloc.c

GH

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: +46 8 694 92 70
Raditex AB             http://www.raditex.se    Fax: +46 8 442 05 91
Sickla Alle 7, 1tr                              Mob: 070-5530148
131 34  NACKA, SWEDEN






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]