garbage collector never runs!!
Mike Stump
mrs@windriver.com
Fri Dec 8 08:49:00 GMT 2000
> Date: Fri, 08 Dec 2000 01:52:07 -0800
> From: Rob Willis <rob@e-critical.com>
> To: gcc@gcc.gnu.org
> I've been having some strange "memory leaks" in my code. So i spent
> a lot of time trying to track down the problem only to discover my
> "leak" seems to caused by the default behaviour of the gc.
It isn't really gc. Also, this has nothing to do with the compiler,
making this the wrong list.
Welcome to UNIX, welcome to C, welcome to malloc.
If you want to learn more about this, you you may want to study
malloc, brk, sbrk and mmap behaviors. There is far too much detail
here for me to do a good job of it. Simply put, it is most optimal to
do what is done. One can get the specific memory performance you
want, if you are willing to sacrifice performance? If you want to do
that, call mmap yourself, once per allocation. Most people, in most
situations do not want to do this, which is why malloc does what it
does.
At this point, I would recommend checking out the malloc source code
from glibc, and studying it. There might be a book or some papers
about this sort of stuff, but I don't happen to have a reference.
More information about the Gcc
mailing list