diff --git a/scripts/ost_config.in b/scripts/ost_config.in
index f109f8b2d6188c65adb7c5157fc70b42692869d4..afce131f195b2f17c0198ac7439402916b15f4fb 100644
--- a/scripts/ost_config.in
+++ b/scripts/ost_config.in
@@ -53,6 +53,14 @@ if [ -n "$DNG_ATTACH_VALGRIND" ]; then
   pyexec="`which valgrind`#--leak-check=full#$pyexec"
 fi
 
+if [ -n "$DNG_ATTACH_VALGRIND_MASSIF" ]; then
+  if [ ! -x `which valgrind` ]; then
+    echo "Error: valgrind not found!"
+    exit
+  fi
+  pyexec="`which valgrind`#--tool=massif#$pyexec"
+fi
+
 if [ -n "$DNG_PROFILE" ]; then
   if [[ "$DNG_PROFILE" == "yep" ]]; then
     echo "Profiling activated using yep"