Magic numbers when debugging with gcc/g++/gdb/valgrind?
Microsoft's Visual C++ fills memory with 'magic numbers' if it hasn't been initialized by the programmer itself. This helps with debugging of uninitialized memory. ( In Visual Studio C++, what are the memory allocation representations? , 0xDEADBEEF vs. NULL ) Is there a similar function when using linux GNU tools (g++/gdb)? Thanks! John Zwinck You can override the C++ operator new to set allocations to your preferred byte pattern: void* operator new(size_t size) { void* mem = malloc(size); if (!mem) { throw std::bad_alloc(); } memset(mem, 0xEE, size); return mem; } You can see the full GCC