30 Dec, 2006, Tyche wrote in the 21st comment:
Votes: 0
I'm pretty sure the Valgrind message is totally generic.

The problem is for some reason alloc_mem has been replaced with alloc_perm (via CREATE macro?). Now you cannot just free the memory allocated with alloc_perm because it's a block pointed by others on a list. In fact free() should never be called from ROM's free_mem() for blocks allocated via alloc_perm(), free_mem() just puts them back on the free list.

Now I don't know from whence the CREATE and DISPOSE macros come from. They are not native to ROM stock code. Clearly there's some misuse here as alloc_perm() is apparently called under the covers. Perhaps the macros were created for a different mud?
30 Dec, 2006, Omega wrote in the 22nd comment:
Votes: 0
he is replacing alloc_mem/alloc_perm with calloc/free, his main issue is that he hasn't done a complete changeover yet. and somewhere he is missing a conversion.
12 Jan, 2007, gazzy123 wrote in the 23rd comment:
Votes: 0
Ok, convertet my rom to use smaugs CREATE/DISPOSE instead of alloc_mem/alloc_perm and free_mem/free_String etc.

Darien said that the mud woud be easier to debug with this instead of the free_lists, do anyone know how to find those memoryleaks?

also when freeing a char structure (ch) should I free every variable in the char_data structure before doing DISPOSE(ch) ?
12 Jan, 2007, Guest wrote in the 24th comment:
Votes: 0
Yes, when disposing of a copy of a struct, you need to free all the string variables from it before calling DISPOSE. If you don't then it will result in leaked memory. With some things that don't get touched much it won't be that noticeable, but if you fail to free up things like object and character data, it can pile up quickly and cause a world of hurt.

As far as memory debugging, I find the best tool for that purpose is Valgrind.
12 Jan, 2007, gazzy123 wrote in the 25th comment:
Votes: 0
Yeah I had some problems with memoryleak taking up 80% of the computers memory.. :/

I saved the output of valgrind:

==4088== ERROR SUMMARY: 24 errors from 5 contexts (suppressed: 25 from 1)
==4088==
==4088== 4 errors in context 1 of 5:
==4088== Invalid read of size 1
==4088== at 0x80747B2: violence_update (fight.c:107)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088== Address 0x2264EA80 is 216 bytes inside a block of size 144400 free'd
==4088== at 0x1B904B04: free (vg_replace_malloc.c:152)
==4088== by 0x80AC6EE: free_char (recycle.c:507)
==4088== by 0x807F748: extract_char (handler.c:1980)
==4088== by 0x8077D0A: raw_kill (fight.c:2083)
==4088== by 0x80765E7: damage (fight.c:1090)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088== 4 errors in context 2 of 5:
==4088== Invalid read of size 4
==4088== at 0x8076648: damage (fight.c:1113)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088== Address 0x2264EA80 is 216 bytes inside a block of size 144400 free'd
==4088== at 0x1B904B04: free (vg_replace_malloc.c:152)
==4088== by 0x80AC6EE: free_char (recycle.c:507)
==4088== by 0x807F748: extract_char (handler.c:1980)
==4088== by 0x8077D0A: raw_kill (fight.c:2083)
==4088== by 0x80765E7: damage (fight.c:1090)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088== 4 errors in context 3 of 5:
==4088== Invalid read of size 2
==4088== at 0x807D50E: is_same_clan (handler.c:294)
==4088== by 0x8076643: damage (fight.c:1111)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088== Address 0x2264EA3A is 146 bytes inside a block of size 144400 free'd
==4088== at 0x1B904B04: free (vg_replace_malloc.c:152)
==4088== by 0x80AC6EE: free_char (recycle.c:507)
==4088== by 0x807F748: extract_char (handler.c:1980)
==4088== by 0x8077D0A: raw_kill (fight.c:2083)
==4088== by 0x80765E7: damage (fight.c:1090)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088== 4 errors in context 4 of 5:
==4088== Invalid read of size 1
==4088== at 0x8076605: damage (fight.c:1099)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088== Address 0x2264EA80 is 216 bytes inside a block of size 144400 free'd
==4088== at 0x1B904B04: free (vg_replace_malloc.c:152)
==4088== by 0x80AC6EE: free_char (recycle.c:507)
==4088== by 0x807F748: extract_char (handler.c:1980)
==4088== by 0x8077D0A: raw_kill (fight.c:2083)
==4088== by 0x80765E7: damage (fight.c:1090)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088== 8 errors in context 5 of 5:
==4088== Invalid read of size 4
==4088== at 0x8076662: damage (fight.c:1116)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088== Address 0x2264EA80 is 216 bytes inside a block of size 144400 free'd
==4088== at 0x1B904B04: free (vg_replace_malloc.c:152)
==4088== by 0x80AC6EE: free_char (recycle.c:507)
==4088== by 0x807F748: extract_char (handler.c:1980)
==4088== by 0x8077D0A: raw_kill (fight.c:2083)
==4088== by 0x80765E7: damage (fight.c:1090)
==4088== by 0x80759CE: one_hit (fight.c:730)
==4088== by 0x8074CE2: multi_hit (fight.c:295)
==4088== by 0x8074796: violence_update (fight.c:100)
==4088== by 0x80BAA09: update_handler (update.c:1264)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
–4088–
–4088– supp: 25 Ugly strchr error in /lib/ld-2.3.2.so
==4088==
==4088== IN SUMMARY: 24 errors from 5 contexts (suppressed: 25 from 1)
==4088==
==4088== malloc/free: in use at exit: 288766079 bytes in 13055 blocks.
==4088== malloc/free: 13299 allocs, 244 frees, 289389499 bytes allocated.
==4088==
==4088== searching for pointers to 13055 not-freed blocks.
==4088== checked 289090120 bytes.
==4088==
==4088==
==4088== 40 bytes in 1 blocks are still reachable in loss record 1 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80ACBFE: __new_buf (recycle.c:696)
==4088== by 0x80AC7B8: new_pcdata (recycle.c:540)
==4088== by 0x80AECC4: load_char_obj (save.c:591)
==4088== by 0x8069E5F: nanny (comm.c:1961)
==4088== by 0x806819D: game_loop_unix (comm.c:832)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 44 bytes in 5 blocks are definitely lost in loss record 2 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80725B4: str_dup (db.c:3240)
==4088== by 0x8070DCC: create_mobile (db.c:2107)
==4088== by 0x80704AD: reset_room (db.c:1748)
==4088== by 0x8070AC7: reset_area (db.c:2012)
==4088== by 0x8070234: area_update (db.c:1625)
==4088== by 0x806E7B0: boot_db (db.c:429)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 256 bytes in 1 blocks are still reachable in loss record 3 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80ABB5D: new_ban (recycle.c:112)
==4088== by 0x806696A: load_bans (ban.c:89)
==4088== by 0x806E7BA: boot_db (db.c:431)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 352 bytes in 1 blocks are still reachable in loss record 4 of 34
==4088== at 0x1B90459D: malloc (vg_replace_malloc.c:130)
==4088== by 0x1B9DC10E: (within /lib/tls/libc-2.3.2.so)
==4088== by 0x1B9DC1CE: fopen (in /lib/tls/libc-2.3.2.so)
==4088== by 0x80AF035: load_char_obj (save.c:691)
==4088== by 0x8069E5F: nanny (comm.c:1961)
==4088== by 0x806819D: game_loop_unix (comm.c:832)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 576 bytes in 1 blocks are still reachable in loss record 5 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806D9F7: load_objects (db2.c:530)
==4088== by 0x806E67C: boot_db (db.c:396)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 1008 bytes in 7 blocks are still reachable in loss record 6 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x8073679: load_roomprogs (db.c:4004)
==4088== by 0x806E630: boot_db (db.c:394)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 1024 bytes in 1 blocks are still reachable in loss record 7 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80ACC6C: __new_buf (recycle.c:710)
==4088== by 0x80AC7B8: new_pcdata (recycle.c:540)
==4088== by 0x80AECC4: load_char_obj (save.c:591)
==4088== by 0x8069E5F: nanny (comm.c:1961)
==4088== by 0x806819D: game_loop_unix (comm.c:832)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 1024 bytes in 1 blocks are still reachable in loss record 8 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x809B91E: load_thread (note.c:236)
==4088== by 0x809B80F: load_notes (note.c:202)
==4088== by 0x806E7B5: boot_db (db.c:430)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 1440 bytes in 10 blocks are still reachable in loss record 9 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80700EC: load_mobprogs (db.c:1553)
==4088== by 0x806E5E4: boot_db (db.c:392)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 1728 bytes in 3 blocks are still reachable in loss record 10 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806FAC5: load_rooms (db.c:1268)
==4088== by 0x806E6C8: boot_db (db.c:398)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 2304 bytes in 4 blocks are still reachable in loss record 11 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AD23C: new_had (recycle.c:921)
==4088== by 0x806EBF8: load_helps (db.c:639)
==4088== by 0x806E572: boot_db (db.c:389)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 4000 bytes in 1 blocks are still reachable in loss record 12 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80694FA: write_to_buffer (comm.c:1740)
==4088== by 0x806BD84: send_to_char (comm.c:2833)
==4088== by 0x80BB3C5: purge_spam (update.c:1557)
==4088== by 0x80BB420: spam_update (update.c:1571)
==4088== by 0x80BAA74: update_handler (update.c:1280)
==4088== by 0x80681B0: game_loop_unix (comm.c:846)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 4608 bytes in 8 blocks are still reachable in loss record 13 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806D4B5: load_mobiles (db2.c:345)
==4088== by 0x806E5BE: boot_db (db.c:391)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 5700 bytes in 145 blocks are indirectly lost in loss record 14 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80725B4: str_dup (db.c:3240)
==4088== by 0x80720C8: fread_string (db.c:2923)
==4088== by 0x809BA51: load_thread (note.c:260)
==4088== by 0x809B80F: load_notes (note.c:202)
==4088== by 0x806E7B5: boot_db (db.c:430)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 17280 bytes in 30 blocks are definitely lost in loss record 15 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806FBF6: load_shops (db.c:1316)
==4088== by 0x806E6EE: boot_db (db.c:399)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 20160 bytes in 35 blocks are still reachable in loss record 16 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806FBF6: load_shops (db.c:1316)
==4088== by 0x806E6EE: boot_db (db.c:399)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 34279 bytes in 2680 blocks are still reachable in loss record 17 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80725B4: str_dup (db.c:3240)
==4088== by 0x806EBBA: load_helps (db.c:630)
==4088== by 0x806E572: boot_db (db.c:389)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 34304 bytes in 134 blocks are still reachable in loss record 18 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806DAD4: load_objects (db2.c:567)
==4088== by 0x806E67C: boot_db (db.c:396)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 35584 bytes in 139 blocks are still reachable in loss record 19 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806FA28: load_rooms (db.c:1242)
==4088== by 0x806E6C8: boot_db (db.c:398)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 42564 (36864 direct, 5700 indirect) bytes in 36 blocks are definitely lost in loss record 20 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x809B91E: load_thread (note.c:236)
==4088== by 0x809B80F: load_notes (note.c:202)
==4088== by 0x806E7B5: boot_db (db.c:430)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 43776 bytes in 76 blocks are still reachable in loss record 21 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AC072: new_affect (recycle.c:292)
==4088== by 0x807E785: affect_to_char (handler.c:1074)
==4088== by 0x807100A: create_mobile (db.c:2171)
==4088== by 0x80704AD: reset_room (db.c:1748)
==4088== by 0x8070AC7: reset_area (db.c:2012)
==4088== by 0x8070234: area_update (db.c:1625)
==4088== by 0x806E7B0: boot_db (db.c:429)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 94080 bytes in 30 blocks are still reachable in loss record 22 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806E8F5: new_load_area (db.c:527)
==4088== by 0x806E544: boot_db (db.c:388)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 108400 bytes in 271 blocks are still reachable in loss record 23 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AD2C7: new_help (recycle.c:943)
==4088== by 0x806EC3B: load_helps (db.c:650)
==4088== by 0x806E572: boot_db (db.c:389)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 114624 bytes in 199 blocks are still reachable in loss record 24 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806D97E: load_objects (db2.c:511)
==4088== by 0x806E67C: boot_db (db.c:396)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 304704 bytes in 1 blocks are still reachable in loss record 25 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AC712: new_pcdata (recycle.c:531)
==4088== by 0x80AECC4: load_char_obj (save.c:591)
==4088== by 0x8069E5F: nanny (comm.c:1961)
==4088== by 0x806819D: game_loop_unix (comm.c:832)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 626176 bytes in 2446 blocks are still reachable in loss record 26 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x808E58D: new_reset_data (mem.c:76)
==4088== by 0x806F57F: load_resets (db.c:1043)
==4088== by 0x806E6A2: boot_db (db.c:397)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 1413120 bytes in 1 blocks are still reachable in loss record 27 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806E233: boot_db (db.c:272)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 2059568 bytes in 2627 blocks are still reachable in loss record 28 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806F92F: load_rooms (db.c:1210)
==4088== by 0x806E6C8: boot_db (db.c:398)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 2572816 bytes in 1 blocks are still reachable in loss record 29 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80ABC18: new_descriptor (recycle.c:155)
==4088== by 0x80685C6: init_descriptor (comm.c:1042)
==4088== by 0x8067F86: game_loop_unix (comm.c:754)
==4088== by 0x8067D10: main (comm.c:449)
==4088==
==4088==
==4088== 3148608 bytes in 372 blocks are still reachable in loss record 30 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806D6B4: load_objects (db2.c:418)
==4088== by 0x806E67C: boot_db (db.c:396)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 7930944 bytes in 281 blocks are still reachable in loss record 31 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806CFEA: load_mobiles (db2.c:225)
==4088== by 0x806E5BE: boot_db (db.c:391)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 11583936 bytes in 1071 blocks are still reachable in loss record 32 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x806F79B: load_rooms (db.c:1149)
==4088== by 0x806E6C8: boot_db (db.c:398)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 11927552 bytes in 728 blocks are still reachable in loss record 33 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AC12A: new_obj (recycle.c:332)
==4088== by 0x807163D: create_object (db.c:2342)
==4088== by 0x8070628: reset_room (db.c:1805)
==4088== by 0x8070AC7: reset_area (db.c:2012)
==4088== by 0x8070234: area_update (db.c:1625)
==4088== by 0x806E7B0: boot_db (db.c:429)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088==
==4088== 246635200 bytes in 1708 blocks are still reachable in loss record 34 of 34
==4088== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==4088== by 0x80AC423: new_char (recycle.c:403)
==4088== by 0x8070B12: create_mobile (db.c:2035)
==4088== by 0x80704AD: reset_room (db.c:1748)
==4088== by 0x8070AC7: reset_area (db.c:2012)
==4088== by 0x8070234: area_update (db.c:1625)
==4088== by 0x806E7B0: boot_db (db.c:429)
==4088== by 0x8067CCF: main (comm.c:442)
==4088==
==4088== LEAK SUMMARY:
==4088== definitely lost: 54188 bytes in 71 blocks.
==4088== indirectly lost: 5700 bytes in 145 blocks.
==4088== possibly lost: 0 bytes in 0 blocks.
==4088== still reachable: 288706191 bytes in 12839 blocks.
==4088== suppressed: 0 bytes in 0 blocks.
–4088– TT/TC: 0 tc sectors discarded.
–4088– 10054 tt_fast misses.
–4088– translate: new 8754 (135808 -> 1834177; ratio 135:10)
–4088– discard 192 (2484 -> 36068; ratio 145:10).
–4088– chainings: 7175 chainings, 0 unchainings.
–4088– dispatch: 23705388 jumps (bb entries); of them 3798829 (16%) unchained.
–4088– 475/25142 major/minor sched events.
–4088– reg-alloc: 1172 t-req-spill, 321696+10201 orig+spill uis,
–4088– 43087 total-reg-rank
–4088– sanity: 476 cheap, 20 expensive checks.
–4088– ccalls: 30150 C calls, 57% saves+restores avoided (101892 bytes)
–4088– 41393 args, avg 0.88 setup instrs each (9628 bytes)
–4088– 0% clear the stack (90138 bytes)
–4088– 11993 retvals, 30% of reg-reg movs avoided (7014 bytes)
–4088–
–4088– —— Valgrind's internal memory use stats follow ——
–4088– AR core : 1 sbs, 3560 bs, 8/8 free bs, 1048576 mmap, 202984 loan
–4088– AR tool : 2 sbs, 30623 bs, 2/2 free bs, 2097152 mmap, 728360 loan
–4088– AR symtab : 3 sbs, 541 bs, 6/6 free bs, 3145728 mmap, 2127624 loan
–4088– AR JITter : 1 sbs, 1 bs, 1/1 free bs, 32768 mmap, 0 loan
–4088– AR client : 281 sbs, 13508 bs, 209/209 free bs, 296546304 mmap, 289394344 loan
–4088– AR demangle: 0 sbs, 0 bs, 0/0 free bs, 0 mmap, 0 loan
–4088– AR exectxt : 1 sbs, 238 bs, 1/1 free bs, 65536 mmap, 13272 loan
–4088– AR errors : 1 sbs, 13 bs, 1/1 free bs, 65536 mmap, 480 loan
–4088– AR transien: 1 sbs, 1 bs, 1/1 free bs, 65536 mmap, 0 loan
–4088– AR core : 1048576 mmap'd, 326048/ 202984 max/curr
–4088– AR tool : 2097152 mmap'd, 885024/ 728360 max/curr
–4088– AR symtab : 3145728 mmap'd, 2271080/ 2127624 max/curr
–4088– AR JITter : 32768 mmap'd, 13792/ 0 max/curr
–4088– AR client : 296546304 mmap'd, 289394344/289394344 max/curr
–4088– AR demangle: 0 mmap'd, 0/ 0 max/curr
–4088– AR exectxt : 65536 mmap'd, 13272/ 13272 max/curr
–4088– AR errors : 65536 mmap'd, 480/ 480 max/curr
–4088– AR transien: 65536 mmap'd, 64/ 0 max/curr
–4088–
–4088– Total shadow reserved: 1491 Mbytes, 172 Mbytes used (11%)
–4088–
–4088– —— Valgrind's ExeContext management stats follow ——
–4088– exectx: 4999 lists, 237 contexts (avg 0 per list)
–4088– exectx: 13594 searches, 13364 full compares (983 per 1000)
–4088– exectx: 142971 cmp2, 146 cmp4, 0 cmpAll



btw this is the DISPOSE i'm using… can I use it to clear strings aswell? like the same as free_string() does.

#define DISPOSE(point) 						\
do \
{ \
if (!(point)) \
{ \
bugf( "Freeing null pointer %s:%d", __FILE__, __LINE__ ); \
fprintf( stderr, "DISPOSEing NULL in %s, line %d\n", __FILE__, __LINE__ ); \
} \
else free(point); \
point = NULL; \
} while(0)
14 Jan, 2007, gazzy123 wrote in the 26th comment:
Votes: 0
Ok, accidently used size(*datatype) instead of just 1 with CREATE() that fixed it.

Now I got problems with freeing stuff that is in hashes like mobs/objs/rooms
causing valgrind to halt and crash the mud.

Darien told me about this.

Is there anyway to see if the structure I'm about to free is a pointer or not in the hash_list?

also found this macros in one of kaisyns code snippets:

#
#define IS_IN_HASH( what, what_type, next, orderby, hash, hash_size, result ) \
#
do \
#
{ \
#
int __iHash = (orderby)%(hash_size); \
#
(result) = false; \
#
for ( what_type *__what = (hash)[__iHash]; __what; __what = __what->next ) \
#
if ( __what == (what) ) \
#
(result) = true; \
#
} while(0);

#
#define REMOVE_FROM_HASH( what, what_type, next, orderby, hash, hash_size ) \
#
do \
#
{ \
#
int __iHash = (orderby)%(hash_size); \
#
if ( (what) == (hash)[__iHash] ) \
#
(hash)[__iHash] = (what)->next; \
#
else \
#
{ \
#
for ( what_type *__what = (hash)[__iHash]; __what; __what = __what->next ) \
#
if ( __what->next == (what) ) \
#
__what->next = (what)->next; \
#
} \
#
} while(0);


is this something I can use?
20.0/26