summaryrefslogtreecommitdiff
path: root/run-with-memleak.sh
diff options
authorRavi Sankar Guntur <[email protected]>2010-09-12 09:50:05 +0530
committerRavi Sankar Guntur <[email protected]>2010-09-12 09:50:05 +0530
commitf62cdfba884b0b50475e045cb7fdaf6a750b5269 (patch)
tree4ed7eb4a6bae2731e0aafeb5191d48c64c1a5e47 /run-with-memleak.sh
downloadmemleak-master.tar.gz
first pushHEADmaster
Diffstat (limited to 'run-with-memleak.sh')
-rwxr-xr-xrun-with-memleak.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/run-with-memleak.sh b/run-with-memleak.sh
new file mode 100755
index 0000000..dbbc359
--- /dev/null
+++ b/run-with-memleak.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Memleak: Detects memory leaks in C or C++ programs
+# Copyright (C) 2010 Ravi Sankar Guntur <[email protected]>
+# Copyright (C) 2010 Prateek Mathur <[email protected]>
+
+# Memleak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3
+# of the License, or any later version.
+
+# Memleak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+# version: 0.3
+
+usage () {
+ echo " Usage: run-with-memleak <--full-mode | --scenario-mode> <program-binary>"
+}
+
+if [ "$#" -ne 2 ]
+then
+ usage
+ exit
+fi
+if [ "$1" = "--scenario-mode" ] || [ "$1" = "--full-mode" ]
+then
+ SCENARIO="$1"
+ echo $SCENARIO
+ export SCENARIO
+ export G_SLICE=always-malloc
+ LD_PRELOAD=/usr/lib/libmemleak.so $2
+else
+ usage
+ exit
+fi