aix_notes

来自「测试内存泄露工具」· 代码 · 共 41 行

TXT
41
字号
From: Martin KrumpolecSent: Tuesday, June 23, 1998 1:11 PMSubject: RE: dmalloc - bug report ?> The problem seems to be that certain libc calls which allocate> memory (strdup for instance) somehow bypass the malloc() call and do> their own allocations.  This confuses dmalloc when the free is called.Hello, I have observed this problem is regarding not only strdup but severalother libc (AIX 4.2) routines allocating memory: scandir, strdup,tempnam, ... When I played a bit, I have found neat idea in the manpages - they adviced to add flags:	-bnso -bI:/lib/syscalls.expto linker options in AIX ... Voila, it suddenly works :)Martin  > -----Original Message----->>> > k>   s.p = (char *) strdup("blah");> > k>   free((void *) s.p);>> > Huh?  No a bug with libdmalloc I don't think.  Looks to me> that strdup> > is not calling malloc at all.  See the 1: before the free> error in the> > logfile?  This indicates that it is the first time that the library> > has been called.  This is very strange.  Strdup should not be using> > its own allocator but who knows.>>   It seems you are right. I have replaced strdup with malloc>   and it went ok ... On my Linux box it works with strdup, so>   conclusion is the AIX's libc has weird implementation of strdup>   (man page says it uses malloc, but it evidently lies)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?