Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: frithjofh on December 02, 2007, 07:53:04 pm
-
hi everybody,
I just got a SIGSEGV on a line I wrote. Checking this with the debugger it said:
cannot acces memory at adress: 0xbaadf00d
I took some time to understand ... could this mean, this adress is "bad food" and will cause an error ...
Not knowing wether this is coded like this on pupose or not at least it gave me a laugh.
greetings from asturias
nausea
ps: is this coded on purpose to spell bad food ?????
-
0xbaadf00d is a magic constant. What exactly it means depends on your operating system (you did not say which one you use).
On some systems, it is the constant which unallocated memory is initialised to, as such a "funny number" has the property of being so "obviously wrong", that you can immediately see what's wrong, even without a sophisticated debugger.
In that case, it would mean you either deleted a memory block and then used it, or you never allocated it.
-
the OS is windows XP, and yes, i found out I din't allocate the memory. a case of one object using another when this does not exist yet... :?
and yes, it is so obviously wrong that I din't see it ...
-
Little quote from Wikipedia on that topic:
0xBAADF00D ("bad food") is used by Microsoft's LocalAlloc(LMEM_FIXED) to indicate uninitialised allocated heap memory.
0xBADDCAFE ("bad cafe") is used by 'watchmalloc' in OpenSolaris to mark allocated but uninitialized memory.
0xDEADBEEF ("dead beef") is used by IBM RS/6000 systems, Mac OS on 32-bit PowerPC processors and the Commodore Amiga as a magic debug value. On Sun Microsystems' Solaris, marks freed kernel memory
-
I have looked there allready, it helped me a lot to know where to search the error, but thanks anyway... :D
Is there any useful list somewhere with those magic numbers in the context of debugging?
greetings from asturias
nausea