News: MALLOC_CHECK_

Kristian Fiskerstrand's blog

Published: 2005-10-12 11:49:03 . Categories: Computer

[kristianf@localhost ~]$ export MALLOC_CHECK_=1
this environmental variable is your friend when dealing with applications acting up. Personally my OpenOffice.org has constantly locked up with errors such as *** glibc detected *** free(): invalid pointer: 0xb0d53f08 ***. The answer is in the notes of "man malloc".

Recent versions of Linux libc (later than 5.4.23) and GNU libc (2.x)
include a malloc implementation which is tunable via environment vari-
ables. When MALLOC_CHECK_ is set, a special (less efficient) implemen-
tation is used which is designed to be tolerant against simple errors,
such as double calls of free() with the same argument, or overruns of a
single byte (off-by-one bugs). Not all such errors can be protected
against, however, and memory leaks can result. If MALLOC_CHECK_ is set
to 0, any detected heap corruption is silently ignored; if set to 1, a
diagnostic is printed on stderr; if set to 2, abort() is called immedi-
ately. This can be useful because otherwise a crash may happen much
later, and the true cause for the problem is then very hard to track
down.


Bookmark this on google Bookmark this on del.icio.us Submit this to digg Bookmark this at yahoo Bookmark this at reddit Bookmark this at furl Search technorati for links to this page Toggle more

Comments

 No comment posted at this time


Name:
Nickname:
E-mail:
Website:
Message:
Read codeImage verification
Put code:

News archive



[Sitemap]