From: Bob H. <rsh...@gm...> - 2011-03-31 23:43:09
|
On Mar 31, 2011, at 5:51 PM, Tom Hughes wrote: > I hadn't looked at the test program before, but I think I know what is > happening there... > > You aren't checking the realloc return value, and when realloc fails it > returns null but leaves the block intact. My guess is that it is failing and > then the following realloc calls are doing realloc on a null pointer (ie > malloc) and probably failing as well. > > At the end you free a null pointer (defined as safe) and are then left with > the orphaned block from the point when the first failure occurred. Oh, rats. That is correct, and that is what is happening in the test program. It's should not be what is happening in the original program though (as I will explain). I changed my test program generator to check for a NULL pointer after every malloc or realloc, and print a message like this: if (m14==NULL) printf("demo program failed re-allocating 2736652288 to 2814722048 bytes for m14 at point 43\n"); where the message reflects what the alloc or realloc was supposed to do. The new test program is at the end of this message (but word wrap may do strange things to it). Now, if I run the test program without valgrind, it finishes without printing anything. But with valgrind, it fails, as you predicted. Output is shown below. Thanks very much for figuring that out-- I should know better. I can try to blame it on hastily writing the converter that generated the test program. But we all know the would be just trying to rationalize my own screw up. OK, So, I conclude from that the presence of valgrind is contributing to the failure of the test program. Possibly there is something about my build that is different with valgrind than without that causes the underlying heap allocator to behave differently. I note that the failure occurs around 2.8G, which is reminiscent of where I ran into allocation limitations on a different unix machine, a machine with 4G of physical RAM and a 32-bit address, about a year ago. Could it be that when I build for valgrind I'm somehow building in 32-bit mode (recall that this is an x86_64 with 32G physical RAM). I've appended my Makefile in case anyone can see something obvious from it (I'm not using any IDE for this, just a bash shell and "make" from the command line). Now, as to why I don't believe that I made the same stupid mistake in the real program... In the real program all alloc, realloc and free calls go through wrapper routines (but see caveat at the end of this paragraph). The wrapper routines check for a NULL pointer from malloc or realloc. If the pointer is NULL, the program kills itself (and tells the user why). Admittedly, the reporting mechanism uses things like fflush and fprintf ad vfprintf before it eventually calls exit(). So it is conceivable that those routines try to do some allocation, fail and then failt to report. Hmmm... (here's the caveat) if any system routine calls alloc or malloc, my wrappers are avoided, regardless of when they happen. So I can't completely rule out a NULL pointer problem. But I still think the possibility of a large memory issue in valgrind is the most promising thing to pursue. Bob H ~~~~ command output ~~~~ $ valgrind --leak-check=full ./lz_memory_test_valgrind ==12345== Memcheck, a memory error detector ==12345== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==12345== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==12345== Command: ./lz_memory_test_valgrind ==12345== ==12345== Warning: set address range perms: large range [0x13dde030, 0x31382050) (noaccess) ==12345== Warning: set address range perms: large range [0x3901d030, 0x6229d050) (noaccess) ==12345== Warning: set address range perms: large range [0x6229e030, 0x96b6a050) (noaccess) ==12345== Warning: set address range perms: large range [0x96b6b030, 0xd60bf050) (noaccess) ==12345== Warning: set address range perms: large range [0xd60c0030, 0x11f944050) (noaccess) ==12345== Warning: set address range perms: large range [0x11f945030, 0x17298d050) (noaccess) ==12345== Warning: set address range perms: large range [0x17298e030, 0x1cedea050) (noaccess) ==12345== Warning: set address range perms: large range [0x1cedeb030, 0x233ddb050) (noaccess) ==12345== Warning: set address range perms: large range [0x233ddc030, 0x2a1478050) (noaccess) ==12345== Warning: set address range perms: large range [0x2a1479030, 0x316c59050) (noaccess) ==12345== Warning: set address range perms: large range [0x316c5a030, 0x3944fa050) (noaccess) ==12345== Warning: set address range perms: large range [0x43dd9b030, 0x4c35e3050) (noaccess) ==12345== Warning: set address range perms: large range [0x4c766c030, 0x553c88050) (noaccess) ==12345== Warning: set address range perms: large range [0x557cad030, 0x5ea929050) (noaccess) ==12345== Warning: set address range perms: large range [0x5ee492030, 0x6872d6050) (noaccess) ==12345== Warning: set address range perms: large range [0x68a7e7030, 0x728c57050) (noaccess) demo program failed re-allocating 2736652288 to 2814722048 bytes for m14 at point 43 demo program failed re-allocating 2814722048 to 2877751296 bytes for m14 at point 44 demo program failed re-allocating 2877751296 to 2937126912 bytes for m14 at point 45 demo program failed re-allocating 2937126912 to 2996256768 bytes for m14 at point 46 demo program failed re-allocating 2996256768 to 3047555072 bytes for m14 at point 47 ... snipped the rest -- nearly all of the rest fail, but not all ==12345== ==12345== HEAP SUMMARY: ==12345== in use at exit: 2,736,652,288 bytes in 1 blocks ==12345== total heap usage: 140 allocs, 64 frees, 33,075,445,557 bytes allocated ==12345== ==12345== 2,736,652,288 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==12345== at 0x4A05F1D: realloc (vg_replace_malloc.c:476) ==12345== by 0x400C89: main (lz_memory_test.c:83) ==12345== ==12345== LEAK SUMMARY: ==12345== definitely lost: 2,736,652,288 bytes in 1 blocks ==12345== indirectly lost: 0 bytes in 0 blocks ==12345== possibly lost: 0 bytes in 0 blocks ==12345== still reachable: 0 bytes in 0 blocks ==12345== suppressed: 0 bytes in 0 blocks ==12345== ==12345== For counts of detected and suppressed errors, rerun with: -v ==12345== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) ~~~~ new test program ~~~~ (same program as earlier post, but tests for NULL added) #include <stdlib.h> #include <stdio.h> int main (int argc, char** argv); int main (int argc, char** argv) { void* m1; void* m2; void* m3; void* m4; void* m5; void* m6; void* m7; void* m8; void* m9; void* m10; void* m11; void* m12; void* m13; void* m14; void* m15; void* m16; void* m17; void* m18; void* m19; void* m20; void* m21; void* m22; void* m23; void* m24; void* m25; void* m26; void* m27; void* m28; void* m29; void* m30; void* m31; void* m32; void* m33; void* m34; m1=malloc((size_t)218); if (m1==NULL) printf("demo program failed allocating 218 bytes for m1 at point 1\n"); m2=malloc((size_t)51); if (m2==NULL) printf("demo program failed allocating 51 bytes for m2 at point 2\n"); m3=malloc((size_t)32); if (m3==NULL) printf("demo program failed allocating 32 bytes for m3 at point 3\n"); m4=malloc((size_t)20); if (m4==NULL) printf("demo program failed allocating 20 bytes for m4 at point 4\n"); m5=malloc((size_t)16); if (m5==NULL) printf("demo program failed allocating 16 bytes for m5 at point 5\n"); m6=malloc((size_t)263984); if (m6==NULL) printf("demo program failed allocating 263984 bytes for m6 at point 6\n"); m7=malloc((size_t)184); if (m7==NULL) printf("demo program failed allocating 184 bytes for m7 at point 7\n"); m8=malloc((size_t)263984); if (m8==NULL) printf("demo program failed allocating 263984 bytes for m8 at point 8\n"); free(m4); m9=malloc((size_t)632); if (m9==NULL) printf("demo program failed allocating 632 bytes for m9 at point 9\n"); m10=malloc((size_t)1024); if (m10==NULL) printf("demo program failed allocating 1024 bytes for m10 at point 10\n"); m11=malloc((size_t)51); if (m11==NULL) printf("demo program failed allocating 51 bytes for m11 at point 11\n"); m12=realloc(NULL,(size_t)16384); if (m12==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m12 at point 12\n"); m13=realloc(NULL,(size_t)16384); if (m13==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m13 at point 13\n"); m14=realloc(NULL,(size_t)16384); if (m14==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m14 at point 14\n"); m15=realloc(NULL,(size_t)5); if (m15==NULL) printf("demo program failed re-allocating 0 to 5 bytes for m15 at point 15\n"); m14=realloc(m14,(size_t)249266176); if (m14==NULL) printf("demo program failed re-allocating 16384 to 249266176 bytes for m14 at point 16\n"); m16=realloc(NULL,(size_t)156); if (m16==NULL) printf("demo program failed re-allocating 0 to 156 bytes for m16 at point 17\n"); m17=realloc(NULL,(size_t)156); if (m17==NULL) printf("demo program failed re-allocating 0 to 156 bytes for m17 at point 18\n"); m18=realloc(NULL,(size_t)1300108); if (m18==NULL) printf("demo program failed re-allocating 0 to 1300108 bytes for m18 at point 19\n"); m19=realloc(NULL,(size_t)1300108); if (m19==NULL) printf("demo program failed re-allocating 0 to 1300108 bytes for m19 at point 20\n"); m20=realloc(NULL,(size_t)5); if (m20==NULL) printf("demo program failed re-allocating 0 to 5 bytes for m20 at point 21\n"); m14=realloc(m14,(size_t)492453888); if (m14==NULL) printf("demo program failed re-allocating 249266176 to 492453888 bytes for m14 at point 22\n"); m14=realloc(m14,(size_t)690487296); if (m14==NULL) printf("demo program failed re-allocating 492453888 to 690487296 bytes for m14 at point 23\n"); m14=realloc(m14,(size_t)881639424); if (m14==NULL) printf("demo program failed re-allocating 690487296 to 881639424 bytes for m14 at point 24\n"); m14=realloc(m14,(size_t)1062551552); if (m14==NULL) printf("demo program failed re-allocating 881639424 to 1062551552 bytes for m14 at point 25\n"); m14=realloc(m14,(size_t)1233666048); if (m14==NULL) printf("demo program failed re-allocating 1062551552 to 1233666048 bytes for m14 at point 26\n"); m14=realloc(m14,(size_t)1392803840); if (m14==NULL) printf("demo program failed re-allocating 1233666048 to 1392803840 bytes for m14 at point 27\n"); m14=realloc(m14,(size_t)1548075008); if (m14==NULL) printf("demo program failed re-allocating 1392803840 to 1548075008 bytes for m14 at point 28\n"); m14=realloc(m14,(size_t)1694433280); if (m14==NULL) printf("demo program failed re-allocating 1548075008 to 1694433280 bytes for m14 at point 29\n"); m14=realloc(m14,(size_t)1835646976); if (m14==NULL) printf("demo program failed re-allocating 1694433280 to 1835646976 bytes for m14 at point 30\n"); m16=realloc(m16,(size_t)160); if (m16==NULL) printf("demo program failed re-allocating 156 to 160 bytes for m16 at point 31\n"); m17=realloc(m17,(size_t)160); if (m17==NULL) printf("demo program failed re-allocating 156 to 160 bytes for m17 at point 32\n"); m15=realloc(m15,(size_t)6); if (m15==NULL) printf("demo program failed re-allocating 5 to 6 bytes for m15 at point 33\n"); m14=realloc(m14,(size_t)1971191808); if (m14==NULL) printf("demo program failed re-allocating 1835646976 to 1971191808 bytes for m14 at point 34\n"); m20=realloc(m20,(size_t)6); if (m20==NULL) printf("demo program failed re-allocating 5 to 6 bytes for m20 at point 35\n"); m14=realloc(m14,(size_t)2106195968); if (m14==NULL) printf("demo program failed re-allocating 1971191808 to 2106195968 bytes for m14 at point 36\n"); m14=realloc(m14,(size_t)2240053248); if (m14==NULL) printf("demo program failed re-allocating 2106195968 to 2240053248 bytes for m14 at point 37\n"); m14=realloc(m14,(size_t)2355216384); if (m14==NULL) printf("demo program failed re-allocating 2240053248 to 2355216384 bytes for m14 at point 38\n"); m14=realloc(m14,(size_t)2462564352); if (m14==NULL) printf("demo program failed re-allocating 2355216384 to 2462564352 bytes for m14 at point 39\n"); m14=realloc(m14,(size_t)2565095424); if (m14==NULL) printf("demo program failed re-allocating 2462564352 to 2565095424 bytes for m14 at point 40\n"); m14=realloc(m14,(size_t)2655453184); if (m14==NULL) printf("demo program failed re-allocating 2565095424 to 2655453184 bytes for m14 at point 41\n"); m14=realloc(m14,(size_t)2736652288); if (m14==NULL) printf("demo program failed re-allocating 2655453184 to 2736652288 bytes for m14 at point 42\n"); m14=realloc(m14,(size_t)2814722048); if (m14==NULL) printf("demo program failed re-allocating 2736652288 to 2814722048 bytes for m14 at point 43\n"); m14=realloc(m14,(size_t)2877751296); if (m14==NULL) printf("demo program failed re-allocating 2814722048 to 2877751296 bytes for m14 at point 44\n"); m14=realloc(m14,(size_t)2937126912); if (m14==NULL) printf("demo program failed re-allocating 2877751296 to 2937126912 bytes for m14 at point 45\n"); m14=realloc(m14,(size_t)2996256768); if (m14==NULL) printf("demo program failed re-allocating 2937126912 to 2996256768 bytes for m14 at point 46\n"); m14=realloc(m14,(size_t)3047555072); if (m14==NULL) printf("demo program failed re-allocating 2996256768 to 3047555072 bytes for m14 at point 47\n"); m14=realloc(m14,(size_t)3095691264); if (m14==NULL) printf("demo program failed re-allocating 3047555072 to 3095691264 bytes for m14 at point 48\n"); m15=realloc(m15,(size_t)15); if (m15==NULL) printf("demo program failed re-allocating 6 to 15 bytes for m15 at point 49\n"); m14=realloc(m14,(size_t)3100606464); if (m14==NULL) printf("demo program failed re-allocating 3095691264 to 3100606464 bytes for m14 at point 50\n"); m20=realloc(m20,(size_t)15); if (m20==NULL) printf("demo program failed re-allocating 6 to 15 bytes for m20 at point 51\n"); m14=realloc(m14,(size_t)3105439744); if (m14==NULL) printf("demo program failed re-allocating 3100606464 to 3105439744 bytes for m14 at point 52\n"); m14=realloc(m14,(size_t)3110240256); if (m14==NULL) printf("demo program failed re-allocating 3105439744 to 3110240256 bytes for m14 at point 53\n"); m14=realloc(m14,(size_t)3114926080); if (m14==NULL) printf("demo program failed re-allocating 3110240256 to 3114926080 bytes for m14 at point 54\n"); m14=realloc(m14,(size_t)3119546368); if (m14==NULL) printf("demo program failed re-allocating 3114926080 to 3119546368 bytes for m14 at point 55\n"); m14=realloc(m14,(size_t)3124166656); if (m14==NULL) printf("demo program failed re-allocating 3119546368 to 3124166656 bytes for m14 at point 56\n"); m14=realloc(m14,(size_t)3128770560); if (m14==NULL) printf("demo program failed re-allocating 3124166656 to 3128770560 bytes for m14 at point 57\n"); m15=realloc(m15,(size_t)16); if (m15==NULL) printf("demo program failed re-allocating 15 to 16 bytes for m15 at point 58\n"); m14=realloc(m14,(size_t)3130458112); if (m14==NULL) printf("demo program failed re-allocating 3128770560 to 3130458112 bytes for m14 at point 59\n"); m20=realloc(m20,(size_t)16); if (m20==NULL) printf("demo program failed re-allocating 15 to 16 bytes for m20 at point 60\n"); m14=realloc(m14,(size_t)3131047936); if (m14==NULL) printf("demo program failed re-allocating 3130458112 to 3131047936 bytes for m14 at point 61\n"); m15=realloc(m15,(size_t)21); if (m15==NULL) printf("demo program failed re-allocating 16 to 21 bytes for m15 at point 62\n"); m14=realloc(m14,(size_t)3131588608); if (m14==NULL) printf("demo program failed re-allocating 3131047936 to 3131588608 bytes for m14 at point 63\n"); m20=realloc(m20,(size_t)21); if (m20==NULL) printf("demo program failed re-allocating 16 to 21 bytes for m20 at point 64\n"); m14=realloc(m14,(size_t)3131801600); if (m14==NULL) printf("demo program failed re-allocating 3131588608 to 3131801600 bytes for m14 at point 65\n"); m14=realloc(m14,(size_t)3131998208); if (m14==NULL) printf("demo program failed re-allocating 3131801600 to 3131998208 bytes for m14 at point 66\n"); m14=realloc(m14,(size_t)3132178432); if (m14==NULL) printf("demo program failed re-allocating 3131998208 to 3132178432 bytes for m14 at point 67\n"); m14=realloc(m14,(size_t)3132375040); if (m14==NULL) printf("demo program failed re-allocating 3132178432 to 3132375040 bytes for m14 at point 68\n"); m14=realloc(m14,(size_t)3132555264); if (m14==NULL) printf("demo program failed re-allocating 3132375040 to 3132555264 bytes for m14 at point 69\n"); m14=realloc(m14,(size_t)3132735488); if (m14==NULL) printf("demo program failed re-allocating 3132555264 to 3132735488 bytes for m14 at point 70\n"); m14=realloc(m14,(size_t)3132932096); if (m14==NULL) printf("demo program failed re-allocating 3132735488 to 3132932096 bytes for m14 at point 71\n"); m14=realloc(m14,(size_t)3133112320); if (m14==NULL) printf("demo program failed re-allocating 3132932096 to 3133112320 bytes for m14 at point 72\n"); m14=realloc(m14,(size_t)3133292544); if (m14==NULL) printf("demo program failed re-allocating 3133112320 to 3133292544 bytes for m14 at point 73\n"); m14=realloc(m14,(size_t)3133472768); if (m14==NULL) printf("demo program failed re-allocating 3133292544 to 3133472768 bytes for m14 at point 74\n"); m15=realloc(m15,(size_t)22); if (m15==NULL) printf("demo program failed re-allocating 21 to 22 bytes for m15 at point 75\n"); m14=realloc(m14,(size_t)3133636608); if (m14==NULL) printf("demo program failed re-allocating 3133472768 to 3133636608 bytes for m14 at point 76\n"); m20=realloc(m20,(size_t)22); if (m20==NULL) printf("demo program failed re-allocating 21 to 22 bytes for m20 at point 77\n"); m14=realloc(m14,(size_t)3133816832); if (m14==NULL) printf("demo program failed re-allocating 3133636608 to 3133816832 bytes for m14 at point 78\n"); m14=realloc(m14,(size_t)3133980672); if (m14==NULL) printf("demo program failed re-allocating 3133816832 to 3133980672 bytes for m14 at point 79\n"); m14=realloc(m14,(size_t)3134160896); if (m14==NULL) printf("demo program failed re-allocating 3133980672 to 3134160896 bytes for m14 at point 80\n"); m14=realloc(m14,(size_t)3134324736); if (m14==NULL) printf("demo program failed re-allocating 3134160896 to 3134324736 bytes for m14 at point 81\n"); m14=realloc(m14,(size_t)3134488576); if (m14==NULL) printf("demo program failed re-allocating 3134324736 to 3134488576 bytes for m14 at point 82\n"); m14=realloc(m14,(size_t)3134652416); if (m14==NULL) printf("demo program failed re-allocating 3134488576 to 3134652416 bytes for m14 at point 83\n"); m14=realloc(m14,(size_t)3134816256); if (m14==NULL) printf("demo program failed re-allocating 3134652416 to 3134816256 bytes for m14 at point 84\n"); m14=realloc(m14,(size_t)3134980096); if (m14==NULL) printf("demo program failed re-allocating 3134816256 to 3134980096 bytes for m14 at point 85\n"); m14=realloc(m14,(size_t)3135143936); if (m14==NULL) printf("demo program failed re-allocating 3134980096 to 3135143936 bytes for m14 at point 86\n"); m14=realloc(m14,(size_t)3135291392); if (m14==NULL) printf("demo program failed re-allocating 3135143936 to 3135291392 bytes for m14 at point 87\n"); m14=realloc(m14,(size_t)3135438848); if (m14==NULL) printf("demo program failed re-allocating 3135291392 to 3135438848 bytes for m14 at point 88\n"); m14=realloc(m14,(size_t)3135553536); if (m14==NULL) printf("demo program failed re-allocating 3135438848 to 3135553536 bytes for m14 at point 89\n"); m14=realloc(m14,(size_t)3135684608); if (m14==NULL) printf("demo program failed re-allocating 3135553536 to 3135684608 bytes for m14 at point 90\n"); m14=realloc(m14,(size_t)3135799296); if (m14==NULL) printf("demo program failed re-allocating 3135684608 to 3135799296 bytes for m14 at point 91\n"); m14=realloc(m14,(size_t)3135881216); if (m14==NULL) printf("demo program failed re-allocating 3135799296 to 3135881216 bytes for m14 at point 92\n"); m14=realloc(m14,(size_t)3135979520); if (m14==NULL) printf("demo program failed re-allocating 3135881216 to 3135979520 bytes for m14 at point 93\n"); m14=realloc(m14,(size_t)3136061440); if (m14==NULL) printf("demo program failed re-allocating 3135979520 to 3136061440 bytes for m14 at point 94\n"); m14=realloc(m14,(size_t)3136110592); if (m14==NULL) printf("demo program failed re-allocating 3136061440 to 3136110592 bytes for m14 at point 95\n"); m14=realloc(m14,(size_t)3136159744); if (m14==NULL) printf("demo program failed re-allocating 3136110592 to 3136159744 bytes for m14 at point 96\n"); m14=realloc(m14,(size_t)3136192512); if (m14==NULL) printf("demo program failed re-allocating 3136159744 to 3136192512 bytes for m14 at point 97\n"); m14=realloc(m14,(size_t)3136241664); if (m14==NULL) printf("demo program failed re-allocating 3136192512 to 3136241664 bytes for m14 at point 98\n"); m14=realloc(m14,(size_t)3136290816); if (m14==NULL) printf("demo program failed re-allocating 3136241664 to 3136290816 bytes for m14 at point 99\n"); m14=realloc(m14,(size_t)3136323584); if (m14==NULL) printf("demo program failed re-allocating 3136290816 to 3136323584 bytes for m14 at point 100\n"); m14=realloc(m14,(size_t)3136372736); if (m14==NULL) printf("demo program failed re-allocating 3136323584 to 3136372736 bytes for m14 at point 101\n"); m14=realloc(m14,(size_t)3136405504); if (m14==NULL) printf("demo program failed re-allocating 3136372736 to 3136405504 bytes for m14 at point 102\n"); m14=realloc(m14,(size_t)3136454656); if (m14==NULL) printf("demo program failed re-allocating 3136405504 to 3136454656 bytes for m14 at point 103\n"); m14=realloc(m14,(size_t)3136487424); if (m14==NULL) printf("demo program failed re-allocating 3136454656 to 3136487424 bytes for m14 at point 104\n"); m14=realloc(m14,(size_t)3136536576); if (m14==NULL) printf("demo program failed re-allocating 3136487424 to 3136536576 bytes for m14 at point 105\n"); m14=realloc(m14,(size_t)3136569344); if (m14==NULL) printf("demo program failed re-allocating 3136536576 to 3136569344 bytes for m14 at point 106\n"); m14=realloc(m14,(size_t)3136618496); if (m14==NULL) printf("demo program failed re-allocating 3136569344 to 3136618496 bytes for m14 at point 107\n"); m14=realloc(m14,(size_t)3136651264); if (m14==NULL) printf("demo program failed re-allocating 3136618496 to 3136651264 bytes for m14 at point 108\n"); m14=realloc(m14,(size_t)3136684032); if (m14==NULL) printf("demo program failed re-allocating 3136651264 to 3136684032 bytes for m14 at point 109\n"); m14=realloc(m14,(size_t)3136733184); if (m14==NULL) printf("demo program failed re-allocating 3136684032 to 3136733184 bytes for m14 at point 110\n"); m14=realloc(m14,(size_t)3136765952); if (m14==NULL) printf("demo program failed re-allocating 3136733184 to 3136765952 bytes for m14 at point 111\n"); m14=realloc(m14,(size_t)3136798720); if (m14==NULL) printf("demo program failed re-allocating 3136765952 to 3136798720 bytes for m14 at point 112\n"); m14=realloc(m14,(size_t)3136847872); if (m14==NULL) printf("demo program failed re-allocating 3136798720 to 3136847872 bytes for m14 at point 113\n"); m14=realloc(m14,(size_t)3136880640); if (m14==NULL) printf("demo program failed re-allocating 3136847872 to 3136880640 bytes for m14 at point 114\n"); m14=realloc(m14,(size_t)3136913408); if (m14==NULL) printf("demo program failed re-allocating 3136880640 to 3136913408 bytes for m14 at point 115\n"); m14=realloc(m14,(size_t)3136946176); if (m14==NULL) printf("demo program failed re-allocating 3136913408 to 3136946176 bytes for m14 at point 116\n"); m14=realloc(m14,(size_t)3136995328); if (m14==NULL) printf("demo program failed re-allocating 3136946176 to 3136995328 bytes for m14 at point 117\n"); m14=realloc(m14,(size_t)3137028096); if (m14==NULL) printf("demo program failed re-allocating 3136995328 to 3137028096 bytes for m14 at point 118\n"); m14=realloc(m14,(size_t)3137060864); if (m14==NULL) printf("demo program failed re-allocating 3137028096 to 3137060864 bytes for m14 at point 119\n"); m14=realloc(m14,(size_t)3137093632); if (m14==NULL) printf("demo program failed re-allocating 3137060864 to 3137093632 bytes for m14 at point 120\n"); m14=realloc(m14,(size_t)3137110016); if (m14==NULL) printf("demo program failed re-allocating 3137093632 to 3137110016 bytes for m14 at point 121\n"); m14=realloc(m14,(size_t)3137126400); if (m14==NULL) printf("demo program failed re-allocating 3137110016 to 3137126400 bytes for m14 at point 122\n"); m14=realloc(m14,(size_t)3137142784); if (m14==NULL) printf("demo program failed re-allocating 3137126400 to 3137142784 bytes for m14 at point 123\n"); m14=realloc(m14,(size_t)3137159168); if (m14==NULL) printf("demo program failed re-allocating 3137142784 to 3137159168 bytes for m14 at point 124\n"); m14=realloc(m14,(size_t)3137175552); if (m14==NULL) printf("demo program failed re-allocating 3137159168 to 3137175552 bytes for m14 at point 125\n"); m21=malloc((size_t)632); if (m21==NULL) printf("demo program failed allocating 632 bytes for m21 at point 126\n"); m22=malloc((size_t)1024); if (m22==NULL) printf("demo program failed allocating 1024 bytes for m22 at point 127\n"); m23=malloc((size_t)32); if (m23==NULL) printf("demo program failed allocating 32 bytes for m23 at point 128\n"); m24=realloc(NULL,(size_t)16384); if (m24==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m24 at point 129\n"); m25=realloc(NULL,(size_t)16384); if (m25==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m25 at point 130\n"); m26=malloc((size_t)12615754384); if (m26==NULL) printf("demo program failed allocating 12615754384 bytes for m26 at point 131\n"); m27=malloc((size_t)160032); if (m27==NULL) printf("demo program failed allocating 160032 bytes for m27 at point 132\n"); m28=realloc(NULL,(size_t)16384); if (m28==NULL) printf("demo program failed re-allocating 0 to 16384 bytes for m28 at point 133\n"); m29=realloc(NULL,(size_t)30); if (m29==NULL) printf("demo program failed re-allocating 0 to 30 bytes for m29 at point 134\n"); m30=realloc(NULL,(size_t)8); if (m30==NULL) printf("demo program failed re-allocating 0 to 8 bytes for m30 at point 135\n"); m30=realloc(m30,(size_t)9); if (m30==NULL) printf("demo program failed re-allocating 8 to 9 bytes for m30 at point 136\n"); m31=malloc((size_t)16777216); if (m31==NULL) printf("demo program failed allocating 16777216 bytes for m31 at point 137\n"); m32=malloc((size_t)16777216); if (m32==NULL) printf("demo program failed allocating 16777216 bytes for m32 at point 138\n"); m33=malloc((size_t)33554432); if (m33==NULL) printf("demo program failed allocating 33554432 bytes for m33 at point 139\n"); m34=malloc((size_t)16777216); if (m34==NULL) printf("demo program failed allocating 16777216 bytes for m34 at point 140\n"); free(m2); free(m14); free(m10); free(m11); free(m15); free(m20); free(m16); free(m17); free(m18); free(m19); free(m12); free(m13); free(m9); free(m3); free(m28); free(m22); free(m23); free(m29); free(m30); free(m24); free(m25); free(m21); free(m1); free(m6); free(m8); free(m26); free(m27); free(m7); free(m5); free(m31); free(m32); free(m33); free(m34); return 0; } ~~~~ my Makefile ~~~~ CFLAGS=-g -O0 -Wall PROGS = lz_memory_test lz_memory_valgrind srcFiles = lz_memory_test \ all: ${PROGS} lz_memory_test.c: lz_memory_log lz_memory_to_allocation_demo.py cat lz_memory_log | ./lz_memory_to_allocation_demo.py > lz_memory_test.c lz_memory_test: lz_memory_test.o lz_memory_valgrind: lz_memory_test_valgrind.o lz_memory_test_valgrind.o: lz_memory_test.c ${CC} -c -g -O0 -pg $< -o $@ clean: rm -f ${PROGS} rm -f *.o |