#1419: Cactus should produce no errors in Valgrind -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Cactus_4.3.0 Component: Cactus | Version: development version Keywords: | -------------------------+-------------------------------------------------- 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.
#1419: Cactus should produce no errors in Valgrind --------------------------+------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Cactus_4.3.0 Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by eschnett):
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.
#1419: Cactus should produce no errors in Valgrind --------------------------+------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Cactus_4.3.0 Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by knarf):
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?
#1419: Cactus should produce no errors in Valgrind --------------------------+------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Cactus_4.3.0 Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by sbrandt):
Very likely it is platform dependent, but I've seen them on more than one platform.
#1419: Cactus should produce no errors in Valgrind --------------------------+------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Cactus_4.3.0 Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by knarf):
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.
#1419: Cactus should produce no errors in Valgrind --------------------------+------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by knarf):
* milestone: Cactus_4.3.0 =>
trac@lists.einsteintoolkit.org