代码拉取完成,页面将自动刷新
#define USE_LOCKS 1
#define USE_DL_PREFIX 1
#define DEBUG 1
#define NO_NED_NAMESPACE
//#define INSECURE 1
//#define DEBUG 1
#define NEDMALLOCDEPRECATED
#define NEDMALLOC_DEBUG 1
//#define FULLSANITYCHECKS
//#define THREADCACHEMAX 0
//#define USE_MAGIC_HEADERS 1
//#define USE_ALLOCATOR 0
// #define MSPACES 1
// #define ONLY_MSPACES 1
#include "nedmalloc.c"
void MallocStabTest(){
printf("test\n");
void ** test=(void**)nedmalloc(1024*1024*16*sizeof(void**));
for(int i=0;i<(1024*1024*16);i++) test[i]=NULL;
for(int j=0;j<10000000;j++){
int testbyte=rand()%((1024*1024*16)-128);
for(int w=0;w<127;w++){
if(test[testbyte+w]){
nedfree(test[testbyte+w]);
test[testbyte+w]=NULL;
}
}
test[testbyte++]=nedmalloc(10);
test[testbyte++]=nedmalloc(40);
test[testbyte++]=nedmalloc(100);
test[testbyte+2]=nedmalloc(100);
test[testbyte+1]=nedmalloc(40);
test[testbyte]=nedmalloc(7);
testbyte+=3;
void * mallblocks[7];
size_t mallsz[7]={10,20,30,40,50,60,70};
nedindependent_comalloc(7, mallsz, mallblocks);
test[testbyte++]=mallblocks[0];
test[testbyte++]=mallblocks[6];
test[testbyte++]=mallblocks[2];
test[testbyte++]=mallblocks[5];
test[testbyte++]=mallblocks[4];
test[testbyte++]=mallblocks[3];
test[testbyte++]=mallblocks[1];
}
for(int i=0;i<(1024*1024*16);i++) if(test[i]) nedfree(test[i]);
nedfree(test);
printf("end\n");
}
int main(void)
{
MallocStabTest();
getchar();
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。