Valgrind gurus, I have an application which allocates data (malloc or calloc) in one thread (Producer). A second thread (Consumer) has the ability to acquire a pointer to this data. Semantically, the second thread "owns" this piece of data. It is responsible for free()ing it. The Producer thread never free()s something that has been passed off in this way.
If this memory block is never free()ed, I want the "allocation location" reported by memcheck in its leak analysis to show the point where the Consumer thread "took possession" of this piece of data. I would like to modify the single function in my application that does the "transfer of possession", called in the Consumer thread, in some way to tell memcheck to update the ExeContext for this block of memory. I'm willing to use a client request (if a suitable one exists already, I could not find it), or roll my own code in memcheck itself, but I need some help getting started. I think I would get the correct behavior by using realloc(), but I don't know the size of the block at the time of the possession transfer. Obviously, memcheck does, so I imagined creating a variant of MC_(realloc) that did not take a size parameter. Alternatively, if I could discover a way to call into memcheck and get the memory allocation size from a pointer that malloc() returned previously, I could just call realloc() as-is. In any case, before I dive too deeply into the memcheck sources, I thought I would ask for assistance here. Thanks in advance for any insight you can provide, -TJ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
