Opened 5 years ago

Last modified 3 years ago

#1419 new enhancement

Cactus should produce no errors in Valgrind

Reported by: Steven R. Brandt Owned by:
Priority: minor Milestone:
Component: Cactus Version: development version
Keywords: Cc:


Valgrind is a useful tool for identifying a large number of coding problems. Currently, running Cactus under valgrind produces a large number of spurious errors due to the implementation of the string library. Attempts to use the valgrind suppression mechanism to eliminate them have proven difficult.

However, these errors all go away if we simply replace all calls to strdup() with calls to util_Strdup(), a function which is already part of Cactus. Making this replacement shouldn't have any negative impacts, and it would make valgrind more usable.

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by Erik Schnetter

util_Strdup is a old function, from times when strdup was not available everywhere. I would deprecate util_Strdup, and replace calls to this function by calls to strdup. This reduces code complexity and probably improves code speed as well.

As to valgrind: Did you report this problem to the valgrind developers? The usual remedies would be (a) upgrade valgrind, or (b) upgrade libc.

Instead of replacing all calls to strdup, you can define your own strdup function somewhere in the flesh, and then link statically to ensure this is the only definition available. This would be simpler than modifying all code, and would also ensure that calls within libraries (e.g. HDF5) are also replaced. Of course, this would be for debugging only, and would not be enabled for production runs.

comment:2 Changed 5 years ago by Frank Löffler

I remember using valgrind on a recent checkout of the ET and I didn't see these messages. Could this be related to a particular implementation of strdup?

comment:3 Changed 5 years ago by Steven R. Brandt

Very likely it is platform dependent, but I've seen them on more than one platform.

comment:4 Changed 5 years ago by Frank Löffler

Is there a cluster where you can reproduce this that a lot of developers have access to? Otherwise it's a bit hard to reproduce.

comment:5 Changed 3 years ago by Frank Löffler

Milestone: Cactus_4.3.0

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
Next status will be 'review'.
as The resolution will be set.
to The owner will be changed from (none) to the specified user.
Next status will be 'confirmed'.
The owner will be changed from (none) to anonymous.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.