Memory management

There is a major problem with our loop:
      arglist = Py_BuildValue("(dd)", *x_i, *y_j);
      result = PyEval_CallObject(func1, arglist);
      *a_ij = PyFloat_AS_DOUBLE(result);
For each pass, arglist and result are dynamically allocated, but not destroyed
From the Python side, memory management is automatic
From the C side, we must do it ourself
Python applies reference counting
Each object has a number of references, one for each usage
The object is destroyed when there are no references

previousnexttable of contents