Index: trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
===================================================================
--- trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 8812)
+++ trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 8813)
@@ -1034,4 +1034,6 @@
         assert self.conserved_quantities[2] == 'ymomentum', msg
 
+        
+    #@profile
     def extrapolate_second_order_sw(self):
         """Fast version of extrapolation from centroids to edges"""
@@ -1040,5 +1042,5 @@
         extrapol2(self)
 
-
+    #@profile
     def compute_fluxes(self):
         """Compute fluxes and timestep suitable for all volumes in domain.
@@ -1082,9 +1084,21 @@
             # Use standard flux calculation, but calc gravity
             # as -g h grad(w) - sum midpoint edge pressure terms
+            import objgraph
+            #print 50*"="
+            #objgraph.show_most_common_types()
+            #print objgraph.typestats(objgraph.get_leaking_objects())
+            #objgraph.show_growth()
+
             from shallow_water_ext import compute_fluxes_ext_central_structure
             from shallow_water_ext import gravity_wb as gravity_wb_c
 
             self.flux_timestep = compute_fluxes_ext_central_structure(self)
+
+            #print 50*"-"
+            #objgraph.show_most_common_types()
             gravity_wb_c(self)
+
+            #print 50*"-"
+            #objgraph.show_most_common_types()
 
         elif self.compute_fluxes_method == 'wb_3':
Index: trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c
===================================================================
--- trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c	(revision 8812)
+++ trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c	(revision 8813)
@@ -1926,4 +1926,5 @@
         D.ymom_explicit_update[k] += -g * zy*avg_h;
     }
+
 
     return Py_BuildValue("");
@@ -2770,4 +2771,5 @@
     beta_vh_dry            = D->beta_vh_dry;
     optimise_dry_cells     = D->optimise_dry_cells;
+
     extrapolate_velocity_second_order = D->extrapolate_velocity_second_order;
 
@@ -5482,5 +5484,5 @@
     timestep = _compute_fluxes_central_structure(&D);
 
-
+    
     return Py_BuildValue("d", timestep);
 }
@@ -5533,4 +5535,5 @@
     // the explicit update arrays
     timestep = _compute_fluxes_central_wb(&D);
+
 
 
Index: trunk/anuga_core/source/anuga/shallow_water/sw_domain.h
===================================================================
--- trunk/anuga_core/source/anuga/shallow_water/sw_domain.h	(revision 8812)
+++ trunk/anuga_core/source/anuga/shallow_water/sw_domain.h	(revision 8813)
@@ -253,4 +253,21 @@
     D->ymom_explicit_update  = get_python_array_data_from_dict(quantities, "ymomentum", "explicit_update");
 
+
+    Py_DECREF(quantities);
+
+    Py_DECREF(neighbours);
+    Py_DECREF(surrogate_neighbours);
+    Py_DECREF(neighbour_edges);
+    Py_DECREF(normals);
+    Py_DECREF(edgelengths);
+    Py_DECREF(radii);
+    Py_DECREF(areas);
+    Py_DECREF(tri_full_flag);
+    Py_DECREF(already_computed_flux);
+    Py_DECREF(vertex_coordinates);
+    Py_DECREF(edge_coordinates);
+    Py_DECREF(centroid_coordinates);
+    Py_DECREF(max_speed);
+    Py_DECREF(number_of_boundaries);
 
     return D;
Index: trunk/anuga_core/source/anuga/test_all.py
===================================================================
--- trunk/anuga_core/source/anuga/test_all.py	(revision 8812)
+++ trunk/anuga_core/source/anuga/test_all.py	(revision 8813)
@@ -33,5 +33,5 @@
 
 # Directories that should not be searched for test files.
-exclude_dirs = ['shallow_water_balanced' , # Special requirements
+exclude_dirs = ['shallow_water_balanced' , 'damage_modelling', # Special requirements
                 '.svn',          # subversion
                 'props', 'wcprops', 'prop-base', 'text-base', 'tmp']
Index: trunk/anuga_core/source/anuga/utilities/util_ext.h
===================================================================
--- trunk/anuga_core/source/anuga/utilities/util_ext.h	(revision 8812)
+++ trunk/anuga_core/source/anuga/utilities/util_ext.h	(revision 8813)
@@ -293,5 +293,5 @@
   */
     
-  B = (PyArrayObject*) PyObject_GetAttrString(O, name);
+  B = (PyArrayObject*) PyObject_GetAttrString(O, name);  // New Reference
 
   //printf("B = %p\n",(void*)B);
@@ -306,5 +306,5 @@
   //Convert to consecutive array
   A = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*) B, 
-						    B -> descr -> type, 0, 0);
+						    B -> descr -> type, 0, 0);   // New Reference
   
   Py_DECREF(B); //FIXME: Is this really needed??
@@ -330,5 +330,5 @@
 
   //Get double from attribute
-  TObject = PyObject_GetAttrString(O, name);
+  TObject = PyObject_GetAttrString(O, name); //New Reference
   if (!TObject) {
 	snprintf(buf, BUFFER_SIZE, "util_ext.h: get_python_double could not obtain double %s.\n", name);
@@ -377,5 +377,5 @@
   PyObject *Oout;
 
-  Oout = PyObject_GetAttrString(O, name);
+  Oout = PyObject_GetAttrString(O, name); // New Reference
   if (!Oout) {
     PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_object could not obtain object");
@@ -391,9 +391,19 @@
   PyObject *A;
   PyArrayObject *B;
-
-  A = PyDict_GetItemString(O, name);
-  B = get_consecutive_array(A, array);
-
-  return (double *) B->data;
+  double *data;
+
+  A = PyDict_GetItemString(O, name); // Borrowed Reference
+  if (!A) {
+    PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_array_from_object could not obtain object");
+    return NULL;
+  }
+  B = get_consecutive_array(A, array); // New Reference
+
+
+  data = (double *) B->data;
+
+  Py_DECREF(B);
+
+  return data;
 }
 
