Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FIX: Memory leak in python binding

Due to giving to python objects with a refcount=2 while they are only
bound once.
  • Loading branch information...
commit 316950c1df3a06002168f58153d647bd290b7d35 1 parent 2560eb1
Julien Palard authored
Showing with 73 additions and 4 deletions.
  1. +60 −0 ChangeLog
  2. +12 −3 logtop.i
  3. +1 −1  setup.py
View
60 ChangeLog
@@ -1,3 +1,63 @@
+2013-07-26 09:57:55 +0200 Julien Palard <julien@palard.fr>
+
+ * FIX: Memory leak in python binding
+
+2013-04-12 11:23:33 +0200 Julien Palard <julien@palard.fr>
+
+ * Adding some doc about python module dependencies
+
+2013-03-20 11:36:33 +0100 Julien Palard <julien@palard.fr>
+
+ * NEW: Give also global frequency to python module
+
+2013-03-20 11:30:08 +0100 Julien Palard <julien@palard.fr>
+
+ * NEW: Give frequency of every lines to python module
+
+2013-03-20 10:01:36 +0100 Julien Palard <julien@palard.fr>
+
+ * FIX: Continue to increment time when no new lines are fed
+
+2013-03-20 09:54:29 +0100 Julien Palard <julien@palard.fr>
+
+ * Cleaning .pyc files
+
+2013-03-20 09:54:21 +0100 Julien Palard <julien@palard.fr>
+
+ * Adding a test file for python module
+
+2013-03-19 18:43:40 +0100 Julien Palard <julien@palard.fr>
+
+ * Do not give simplified representation of the string to python, seems useless.
+
+2013-03-14 00:28:52 +0100 Julien Palard <julien@palard.fr>
+
+ * Adding python module via swig
+
+2013-03-14 00:25:40 +0100 Julien Palard <julien@palard.fr>
+
+ * Simplier to use a struct for swig
+
+2013-03-13 23:37:58 +0100 Julien Palard <julien@palard.fr>
+
+ * Adding a logtop_get function
+
+2013-03-13 23:11:18 +0100 Julien Palard <julien@palard.fr>
+
+ * Provide a logtop_delete function, renames for consistency
+
+2013-03-13 19:11:18 +0100 Julien Palard <julien@palard.fr>
+
+ * Renaming frequency -> logtop, more consistent
+
+2013-03-13 19:06:24 +0100 Julien Palard <julien@palard.fr>
+
+ * Renaming logtop -> main (see next commit)
+
+2013-03-13 18:34:34 +0100 Julien Palard <julien@palard.fr>
+
+ * Splitting code, first step to provide a lib_logtop.
+
2012-11-17 23:48:35 +0100 Julien Palard <julien@palard.fr>
* UPDATE: Display improvment
View
15 logtop.i
@@ -9,6 +9,7 @@
int i;
PyObject *log_line;
PyObject *lines;
+ PyObject *tmp;
$result = PyDict_New();
lines = PyList_New(0);
@@ -19,12 +20,20 @@
PyTuple_SetItem(log_line, 1, PyFloat_FromDouble(result->lines[i]->frequency));
PyTuple_SetItem(log_line, 2, PyString_FromString(result->lines[i]->string));
PyList_Append(lines, log_line);
+ Py_DECREF(log_line);
i++;
}
PyDict_SetItemString($result, "lines", lines);
- PyDict_SetItemString($result, "count", PyInt_FromLong(result->count));
- PyDict_SetItemString($result, "timespan", PyFloat_FromDouble(result->timespan));
- PyDict_SetItemString($result, "frequency", PyFloat_FromDouble(result->frequency));
+ Py_DECREF(lines);
+ tmp = PyInt_FromLong(result->count);
+ PyDict_SetItemString($result, "count", tmp);
+ Py_DECREF(tmp);
+ tmp = PyFloat_FromDouble(result->timespan);
+ PyDict_SetItemString($result, "timespan", tmp);
+ Py_DECREF(tmp);
+ tmp = PyFloat_FromDouble(result->frequency);
+ PyDict_SetItemString($result, "frequency", tmp);
+ Py_DECREF(tmp);
free(result->lines);
free(result);
}
View
2  setup.py
@@ -16,7 +16,7 @@
)
setup (name = 'logtop',
- version = '0.1',
+ version = '0.2',
author = "Julien Palard",
description = """Live line frequency analyzer""",
ext_modules = [logtop_module],
Please sign in to comment.
Something went wrong with that request. Please try again.