Development/malloc check

From KDE TechBase
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


MALLOC_CHECK_

The MALLOC_CHECK_ environment variable is used in malloc(3), to decide which implementation use. It could have 4 different values:

  • MALLOC_CHECK_ is not set: When MALLOC_CHECK_ has not been set, then malloc(3) have the usual behavior, nothing special happens.
  • MALLOC_CHECK_ = 0: All errors are silently ignored.
  • MALLOC_CHECK_ = 1: On error, a diagnostic message is printed on stderr.
  • MALLOC_CHECK_ = 2: On error, abort(3) is called without a diagnostic message.
  • MALLOC_CHECK_ = 3: abort(3) is called, and a diagnostic message is printed.


startkde script set this variable to 2 in trunk, so maybe you'll have crashes because of that.

Notice that, the faster implementation is which is used when MALLOC_CHECK_ is not defined.

More information in malloc(3).

Example of crash because of this variable.