⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aix_notes

📁 减少内存碎片的malloc分配函数
💻
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -