dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #11921
Re: [HG DOLFIN] Add Rivara refinement patch by Jansson/Sawicki
Attached patch should remove this leakage.
Valgrind reports "All heap blocks were freed -- no leaks are possible."
regrds.
On 29/01/09 03:48 AM, Garth N. Wells wrote:
There are some memory leaks in this code.
Pointers are used extensively in this code - can their use be reduced to
help readability and to minimise the likelihood of leaks?
Garth
DOLFIN wrote:
One or more new changesets pushed to the primary dolfin repository.
A short summary of the last three changesets is included below.
changeset: 5609:183deaf2428c90177bdb0c3220dc12891780e92e
tag: tip
user: Anders Logg <logg@xxxxxxxxx>
date: Thu Jan 29 10:13:16 2009 +0100
files: dolfin/mesh/LocalMeshRefinement.cpp dolfin/mesh/LocalMeshRefinement.h dolfin/mesh/Mesh.cpp dolfin/mesh/RivaraRefinement.cpp dolfin/mesh/RivaraRefinement.h
description:
Add Rivara refinement patch by Jansson/Sawicki
changeset: 5608:f7257fc94661ae937756a68c5ccd1b4c5f864aa5
user: Anders Logg <logg@xxxxxxxxx>
date: Wed Jan 28 21:33:03 2009 +0100
files: TODO
description:
Add item to TODO list
changeset: 5607:aa4015f7f2e52d18b721fe08962e87bb522d5648
user: "Garth N. Wells <gnw20@xxxxxxxxx>"
date: Tue Jan 27 16:52:18 2009 +0000
files: demo/pde/elastodynamics/ElastoDynamics.form demo/pde/elastodynamics/ElastoDynamics.h demo/pde/elastodynamics/SConstruct demo/pde/elastodynamics/cpp/DG0_eps_xx.form demo/pde/elastodynamics/cpp/DG0_eps_xx.h demo/pde/elastodynamics/cpp/ElastoDynamics.form demo/pde/elastodynamics/cpp/ElastoDynamics.h demo/pde/elastodynamics/cpp/SConstruct demo/pde/elastodynamics/cpp/main.cpp demo/pde/elastodynamics/main.cpp
description:
Make elastodynamics example more interesting.
Add viscous damping term.
----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/dolfin
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev
diff -r 295fd4a03933 dolfin/mesh/RivaraRefinement.cpp
--- a/dolfin/mesh/RivaraRefinement.cpp Thu Jan 29 10:43:33 2009 +0000
+++ b/dolfin/mesh/RivaraRefinement.cpp Thu Jan 29 15:26:25 2009 -0700
@@ -46,7 +46,10 @@
{
DCell* dc = *it;
if(dc->deleted)
+ {
+ delete *it;
it = dmesh.cells.erase(it);
+ }
else
it++;
}
@@ -86,6 +89,19 @@
RivaraRefinement::DMesh::DMesh() : vertices(0), cells(0)
{
// Do nothing
+}
+//-----------------------------------------------------------------------------
+RivaraRefinement::DMesh::~DMesh()
+{
+ // Delete allocated DVertices
+ for(std::list<DVertex* >::iterator it = vertices.begin();
+ it != vertices.end(); ++it)
+ delete *it;
+
+ // Delete allocated DCells
+ for(std::list<DCell* >::iterator it = cells.begin();
+ it != cells.end(); ++it)
+ delete *it;
}
//-----------------------------------------------------------------------------
void RivaraRefinement::DMesh::importMesh(Mesh& mesh)
@@ -289,7 +305,6 @@
bisect(copp, mv, v0, v1);
else
break;
- }
}
}
}
diff -r 295fd4a03933 dolfin/mesh/RivaraRefinement.h
--- a/dolfin/mesh/RivaraRefinement.h Thu Jan 29 10:43:33 2009 +0000
+++ b/dolfin/mesh/RivaraRefinement.h Thu Jan 29 15:26:25 2009 -0700
@@ -58,6 +58,7 @@
{
public:
DMesh();
+ ~DMesh();
void addVertex(DVertex* v);
void addCell(DCell* c, std::vector<DVertex*> vs, int parent_id);
void removeCell(DCell* c);
References