Anonymous avatar Anonymous committed 5f4a3d7

Added valgrind script for memory leak checking.

Comments (0)

Files changed (3)

src/base/streamwrapper.c

     interp = thread->interp;
     wrapper->thread = PyThreadState_New (interp);
 #endif
-    
+
     if (PyObject_HasAttrString (obj, "read"))
     {
         wrapper->read = PyObject_GetAttrString (obj, "read");

src/sdl/rwopsmod.c

     SDL_RWops *ops;
     PyInterpreterState* interp;
     PyThreadState* thread;
-    
+
     if (!obj || !canautoclose)
     {
         PyErr_SetString (PyExc_TypeError, "argument is NULL");
     SDL_RWops *ops;
     PyInterpreterState* interp;
     PyThreadState* thread;
-    
+
     if (!obj || !canautoclose)
     {
         PyErr_SetString (PyExc_TypeError, "argument is NULL");
+#!/bin/sh
+
+# Path to the debug version of python
+: ${PYDEBUG:="/opt/python-debug/bin/python"}
+# Valgrind checker application and the default arguments to use.
+: ${VALGRIND:="valgrind"}
+: ${VALGRINDARGS:="--tool=memcheck --leak-check=summary"}
+
+usage()
+{
+    echo "usage: `basename $0` [-f|-r|-s] file ..."
+}
+
+while getopts frs arg; do
+    case $arg in
+        f)
+            DEFARGS="--tool=memcheck --leak-check=full"
+            ;;
+        r)
+            DEFARGS="--tool=memcheck --leak-check=full --show-reachable=yes"
+            ;;
+        s)
+            DEFARGS="--tool=memcheck --leak-check=summary"
+            ;;
+        \? | h)
+            usage
+            exit 2
+    esac
+done
+
+shift $(expr $OPTIND - 1)
+if [ $# -eq 0 ]; then
+    usage
+    exit 1
+fi
+
+for f in $@; do
+    $VALGRIND $DEFARGS $PYDEBUG -E $f
+done
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.