|
From: Bart V. A. <bar...@gm...> - 2009-06-02 07:54:21
|
On Tue, Jun 2, 2009 at 9:36 AM, Konstantin Serebryany <kon...@gm...> wrote: > On Mon, Jun 1, 2009 at 8:19 PM, Bart Van Assche >> One additional remark regarding the ANNOTATE_HAPPENS_* macro's: a data >> race detection tool has to allocate some memory to keep track of the >> inter-thread ordering imposed by these annotations. > > True. > >> Since >> ANNOTATE_HAPPENS_AFTER may be invoked multiple times with the same >> argument, a tool cannot know when it can free the memory allocated to >> implement such an annotation. I have added the >> ANNOTATE_HAPPENS_AFTER_DONE() annotation in drd.h for this purpose. > > I would avoid doing this. > Once the program frees the memory which was used as an argument to > ANNOTATE_HAPPENS_*, the detector may release the resources. > (ThreadSanitizer doesn't do this now. I haven't seen this as a > problem, but maybe it is...) I agree that the tool should free the allocated resources at the time the client object is freed. But what should a tool do when the argument passed to ANNOTATE_HAPPENS_* is not a valid client address, such as in unit tests 30 and 31 ? Bart. |