Caveats

QNX SDP8.0Programmer's GuideDeveloper

  • The librcheck library, when enabled with various checking, uses more stack space (i.e., calls more functions, uses more local variables, etc.) than the regular libc allocator.

    This design implies that programs that explicitly set the stack size to something smaller than the default may encounter problems such as running out of stack space. This may cause the program to crash. You can prevent this by increasing the stack space allocated to the threads in question.

  • When the librcheck library reports errors, it doesn't always exit immediately; instead it continues to perform the operation that causes the error, and corrupts the heap (since the operation that raises the warning is actually an illegal operation). You can control this behavior by using the MALLOC_WARN and MALLOC_FATAL handlers described earlier. If you don't provide specific handlers, the heap gets corrupted, and other errors could result and be reported later because of the first error. The best solution is to focus on the first error and fix it before moving onto other errors.
  • Although the librcheck library allocates blocks to the process using the same algorithms as the standard allocator, the library itself requires additional storage to maintain block information, as well as to perform sanity checks. This means that the layout of blocks in memory using the debug allocator is slightly different than with the standard allocator.
  • If you use certain optimization options such as -O1, -O2, or -O3, the librcheck library won't work correctly because these options make gcc use builtin versions of some functions, such as strcpy() and strcmp(). Use the -fno-builtin option to prevent this.
Page updated: