c++ - AIX: malloc in _snw(unsigned long)? -
i'm trying track malloc allocations in test program in aix. such, i've substituted malloc new_malloc calls old system malloc, prints out call stack using call system("procstack pid"). curiously, in of calls this:
0x09000000000ae23c waitpid(??, ??, ??) + 0x190 0x090000000018d8e0 system(??) + 0x1fc 0x0000000100011a34 printcallstack__()() + 0x34 0x000000010000167c malloc(0x80) + 0x3c 0x0000000100011acc __snw(unsigned long)(0x80) + 0x4c 0x0000000100011eac __svn(unsigned long)(0x80) + 0x4c 0x000000010000ac84 main(0x100000001, 0xffffffffffff568) + 0xc4 0x00000001000002d8 __start() + 0x98
what __snw(unsigned long) , __svn(unsigned long) calls coming from, calling malloc (unexpectedly)? appear occur after malloc before printf.
my test code:
char* y = (char*) malloc(128); memset(y, 0, 128); memset(y, 'z', 15); printf("y=%s %p\n", y, y); free(y);
this doesn't answer question (i hope) teach few techniques.
i did:
ls /usr/lib/*.a | while read lib ; echo $lib ; nm $lib 2>/dev/null| egrep '__svn|__snw' ; done
which showed me these coming libc.a. did:
mkdir /tmp/dog cd /tmp/dog ar x /usr/lib/libc.a in * ; echo $i ; nm $i 2> /dev/null | egrep '__svn|__snw' ; done
which shows me came ansicore_32.o
lslpp -w /usr/lib/libc.a
tells me comes xlc.rte -- comes compiler people.
so... not directly answering question, appears has come c++. curious run test c program. c++ has sorts of oddities , not surprising calls malloc. i'm still confused previous questions. if have called new_malloc, why precompile entity start using it?
finally, on bigger question, aix's malloc has tons of features. not come recommendation me. i'm kernel space guy, not application space type guy. little i've used them, i've been frustrated. here link ibm pubs: 6.1 aix pubs. search "mallocdebug" , "mallocoptions" , find various features can use. there (as recall) 3 different malloc algorithms pick , multiple debugging options.
ibm has purify. i've never used (i'm kernel level) apps person highly respect loves it.
last, aix has tracing facilities called "kernel trace" can used in application space too. these far least invasive technique use. little bit of crafting, can leave them off no impact running code still able turn them on (e.g. in field when user has issue can recreate). started, go pubs (above) , search trchook. /etc/trcfmt has lot of information not documented anywhere else.
good luck
Comments
Post a Comment