'make config' allows you to specify that you want memory leak detection. This uses some extra CPU - but I did speed up the RunMalloc code to allow using this on most production servers (!). If you specify 'y' to all features (MEMMAGICNUMS, MEMSIZESTATS, MEMLEAKSTATS, MEMTIMESTATS) then a formatted output of /stats M [server timeoffset1 timeoffset2] will look like:
009 Total allocated memory: 9368752 bytes in 158328 blocks.
*** Memory allocated between 872801625 (server start + 3600 s) and 872841978
(now - 14400 s):
*** Blocks Bytes Location
010 1064 21280 list.c:290
010 1 12 list.c:308
010 8262 132192 userload.c:71
010 404 10172 channel.c:331
010 404 3456 channel.c:333
010 187 37400 list.c:97
010 699 16908 res.c:610
010 1 2036 dbuf.c:103
010 2 60 s_user.c:2665
010 30 1228 s_user.c:2667
010 26 832 channel.c:3951
010 699 27960 res.c:1140
010 699 5592 res.c:1151
010 4 120 res.c:639
010 699 2796 res.c:1154
010 186 20832 list.c:140
010 22 528 list.c:401
010 22 440 list.c:402
010 699 2812 res.c:1171
010 22 2644 list.c:403
010 22 108 list.c:404
010 1 56 list.c:159
010 1 4096 numnicks.c:191
010 71 18104 channel.c:1987