View Issue Details

IDProjectCategoryView StatusLast Update
0000638LDMud 3.6Generalpublic2020-01-09 00:56
Reporterzesstra Assigned ToGnomi  
Status resolvedResolutionfixed 
Product Version3.3.718 
Fixed in Version3.6.1 
Summary0000638: RfC: optionally instrument allocators with valgrind client requests?
DescriptionValgrind is a useful tool for findings memory leaks, illegal memory accesses and alike. Unfortunately, we use custom memory allocators which impairs valgrind's ability for find leaks and illegal memory accesses.
Valgrind supports custom allocators, if they mark their memory blocks by using VALGRIND_MALLOCLIKE_BLOCK upon allocation and VALGRIND_FREELIKE_BLOCK upon free'ing memory.
These macros from valgrind evaluate to 0 and do nothing if the program is not run in valgrind. If not enabled by configure, we could define them empty and have no runtime impact at all.

a) I would like to hear your opinions about adding them (enabled by a configure switch) to our allocators in mem_alloc(), mem_free() and alike.

b) additionally valgrind supports to set blocks of memory as 'inaccessable', 'accessable, undefined' and 'accessable,defined'. We could use them in xalloc()/xfree(). Read/Write accesses to free'd blocks/chunks which are marked as not accessable will cause valgrind to issue warnings.

c) Additionally we might mark our the administrative structures (block headers) as not accessable and see if we catch bugs like 0000574.

d) In a later step we might use valgrind's support for memory pools.
a) and b) might be a useful thing to do and they have a low overhead in adding the stuff to our codebase and have a very low runtime overhead (even none, if not enabled in configure).
TagsNo tags attached.



2009-05-20 02:35

manager   ~0001124

Sounds good. I have no objections.


2010-03-08 15:57

administrator   ~0001769

Uh, Gnomi took over this task, so transferring the issue to him as well.

Issue History

Date Modified Username Field Change
2009-05-19 18:17 zesstra New Issue
2009-05-19 18:17 zesstra Status new => assigned
2009-05-19 18:17 zesstra Assigned To => zesstra
2009-05-20 02:35 Gnomi Note Added: 0001124
2009-05-25 09:53 zesstra Project LDMud => LDMud 3.3
2009-05-26 03:40 zesstra Target Version 3.3.719 => 3.3.720
2010-03-08 15:56 zesstra Assigned To zesstra => Gnomi
2010-03-08 15:57 zesstra Note Added: 0001769
2011-02-22 23:59 zesstra Target Version 3.3.720 => 3.3.721
2020-01-09 00:55 Gnomi Project LDMud 3.3 => LDMud 3.6
2020-01-09 00:55 Gnomi Category Other => General
2020-01-09 00:56 Gnomi Status assigned => resolved
2020-01-09 00:56 Gnomi Resolution open => fixed
2020-01-09 00:56 Gnomi Fixed in Version => 3.6.1