For more information on memory debugging with WDB, see the Debugging Dynamic Memory Usage Errors Using HP WDB whitepaper at the HP WDB Documentation webpage at: http://www.hp.com/go/wdb.

14.10.1 When to suspect a memory leak

You should suspect a memory leak in the code when you notice that the system is running out of swap space or running slower, or both.

Applications or non-kernel code (including daemons) that have memory leaks can eventually use up all swap space. You can run top(1) to verify whether the process data space (SIZE, RES) is growing more than you expect.

If the system is running out of swap space, programs will fail with out-of-memory (ENOMEM) errors or SIGBUS signals. In addition, the system might run slower and slower until it comes to a stop; all processes requiring swap to continue running will wait for it indefinitely. GDB allows you to catch out-of-memory conditions through runtime memory checking. Use the command catch nomem to detect out-of-memory conditions. GDB will stop whenever malloc returns NULL and allows you to look at the current context.

14.10.2 Memory debugging restrictions

Programs with these attributes are not supported:

CMA or DCE threaded programs on 11.x (32-bit and 64-bit)

Memory checking features. These features work only in programs that directly or indirectly call malloc, realloc, free, mmap, or munmap from the standard C library libc.sl.

Programs that link the archive version of the standard C library, libc.a, or the core library, libcl.a, on HP-UX 11.x

NOTE: Linker with version number B.11.19 or higher is required for debugging memory problems.

From HP WDB 5.7 onwards, the archive version of the run time check library, librtc.a, is not available. You must use the shared version of the library, librtc.[slso], instead.

14.10.3Memory Debugging Methodologies

WDB enables you to debug memory problems in applications written for HP-UX 11.x or later using C, aC++, FORTRAN 77, and Fortran 90.

WDB provides several commands that help expose memory-related problems.

158 HP-UX Configuration-Specific Information