From 9c8fbcd3e67eb36b15eedec6b2c73d077db6bae3 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 27 May 2013 13:32:13 +0000 Subject: [PATCH] Memory leak in python in MEDCouplingFieldDiscretization::New --- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 5 +++++ src/MEDCoupling_Swig/MEDCouplingCommon.i | 1 + 2 files changed, 6 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 533763ecf..233f3e06f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -12645,6 +12645,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): a,b=m.distanceToPoint(pt) self.assertAlmostEqual(expectedDist,a,14) self.assertEqual(3,b) + # + fd=MEDCouplingFieldDiscretization.New(ON_CELLS) + self.assertEqual(24,fd.getNumberOfTuples(m)) + fd=MEDCouplingFieldDiscretization.New(ON_NODES) + self.assertEqual(26,fd.getNumberOfTuples(m)) pass def setUp(self): diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 713971291..aac8f18ea 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -94,6 +94,7 @@ using namespace INTERP_KERNEL; %feature("autodoc", "1"); %feature("docstring"); +%newobject ParaMEDMEM::MEDCouplingFieldDiscretization::New; %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr; %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::deepCpy; %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone; -- 2.39.2