Skip to content
Snippets Groups Projects
Commit 5e0f7563 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

Memory pb fixes.

parent d734bc60
Branches
Tags
No related merge requests found
// $Id: 2D_Links.cpp,v 1.7 2001-04-08 20:36:49 geuzaine Exp $ // $Id: 2D_Links.cpp,v 1.8 2001-06-25 13:30:57 remacle Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Const.h" #include "Const.h"
...@@ -79,6 +79,8 @@ int Conversion(DocPeek doc ){ ...@@ -79,6 +79,8 @@ int Conversion(DocPeek doc ){
/* nombre de triangles que l'on doit obtenir */ /* nombre de triangles que l'on doit obtenir */
count2 = 2 * (n - 1) - count2; count2 = 2 * (n - 1) - count2;
if(doc->delaunay)Free (doc->delaunay);
doc->delaunay = (Delaunay *) Malloc(2*count2 * sizeof(Delaunay)); doc->delaunay = (Delaunay *) Malloc(2*count2 * sizeof(Delaunay));
for (i=0;i<n;i++){ for (i=0;i<n;i++){
......
// $Id: 2D_Mesh.cpp,v 1.27 2001-06-06 21:29:58 remacle Exp $ // $Id: 2D_Mesh.cpp,v 1.28 2001-06-25 13:30:57 remacle Exp $
/* /*
Maillage Delaunay d'une surface (Point insertion Technique) Maillage Delaunay d'une surface (Point insertion Technique)
...@@ -456,6 +456,7 @@ int mesh_domain (ContourPeek * ListContours, int numcontours, ...@@ -456,6 +456,7 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
gPointArray = doc->points; gPointArray = doc->points;
numaloc = nump; numaloc = nump;
doc->delaunay = 0;
doc->numPoints = nump; doc->numPoints = nump;
doc->numTriangles = 0; doc->numTriangles = 0;
mai->numtriangles = 0; mai->numtriangles = 0;
...@@ -819,6 +820,9 @@ int mesh_domain (ContourPeek * ListContours, int numcontours, ...@@ -819,6 +820,9 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
mai->listdel[i]->t.b = a; mai->listdel[i]->t.b = a;
} }
} }
// MEMORY LEAK (JF)
// Free(doc->delaunay);
// doc->delaunay = 0;
return 1; return 1;
} }
...@@ -929,7 +933,11 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){ ...@@ -929,7 +933,11 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
s->iEnt = pS->Num; s->iEnt = pS->Num;
Tree_Insert (pS->Simplexes, &s); Tree_Insert (pS->Simplexes, &s);
} }
// MEMORY LEAK (JF)
// Free(M.listdel[i]);
} }
// ANOTHER ONE (JF)
Free (M.listdel);
Free (gPointArray); Free (gPointArray);
} }
...@@ -938,6 +946,7 @@ void Make_Mesh_With_Points (DocRecord * ptr, PointRecord * Liste, int Numpoints) ...@@ -938,6 +946,7 @@ void Make_Mesh_With_Points (DocRecord * ptr, PointRecord * Liste, int Numpoints)
ptr->numTriangles = 0; ptr->numTriangles = 0;
ptr->points = Liste; ptr->points = Liste;
ptr->numPoints = Numpoints; ptr->numPoints = Numpoints;
ptr->delaunay = 0;
DelaunayAndVoronoi (ptr); DelaunayAndVoronoi (ptr);
Conversion (ptr); Conversion (ptr);
remove_all_dlist (ptr->numPoints, ptr->points); remove_all_dlist (ptr->numPoints, ptr->points);
......
// $Id: Generator.cpp,v 1.21 2001-06-25 13:05:16 geuzaine Exp $ // $Id: Generator.cpp,v 1.22 2001-06-25 13:30:57 remacle Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Const.h" #include "Const.h"
...@@ -242,6 +242,13 @@ void mai3d (Mesh * M, int Asked){ ...@@ -242,6 +242,13 @@ void mai3d (Mesh * M, int Asked){
(Asked < oldstatus && Asked > 1)){ (Asked < oldstatus && Asked > 1)){
Msg(STATUS2, "Mesh 2D..."); Msg(STATUS2, "Mesh 2D...");
t1 = Cpu(); t1 = Cpu();
if(M->status == 3)
{
OpenProblem (CTX.filename);
Maillage_Dimension_1 (M);
}
Maillage_Dimension_2 (M); Maillage_Dimension_2 (M);
t2 = Cpu(); t2 = Cpu();
Msg(STATUS2, "Mesh 2D complete (%g s)", t2 - t1); Msg(STATUS2, "Mesh 2D complete (%g s)", t2 - t1);
......
// $Id: Print_Mesh.cpp,v 1.22 2001-06-25 13:05:16 geuzaine Exp $ // $Id: Print_Mesh.cpp,v 1.23 2001-06-25 13:30:57 remacle Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Const.h" #include "Const.h"
...@@ -133,16 +133,16 @@ void add_msh_simplex (void *a, void *b){ ...@@ -133,16 +133,16 @@ void add_msh_simplex (void *a, void *b){
type = TETRAHEDRON; type = TETRAHEDRON;
} }
#if 0 // JF, je comprends pas !? #if 1 // JF, je comprends pas !?
if(type == TETRAHEDRON) if(type == TETRAHEDRON)
{ {
if ((*S)->Volume_Simplexe () > 0){ if ((*S)->Volume_Simplexe () < 0){
Vertex *temp; Vertex *temp;
temp = (*S)->V[0]; temp = (*S)->V[0];
(*S)->V[0] = (*S)->V[1]; (*S)->V[0] = (*S)->V[1];
(*S)->V[1] = temp; (*S)->V[1] = temp;
// if ((*S)->Volume_Simplexe () < 0) // if ((*S)->Volume_Simplexe () < 0)
Msg(WARNING, "Negative volume for simplex %d", (*S)->Num); // Msg(WARNING, "Negative volume for simplex %d", (*S)->Num);
} }
} }
#endif #endif
......
// $Id: Read_Mesh.cpp,v 1.16 2001-06-02 19:44:35 remacle Exp $ // $Id: Read_Mesh.cpp,v 1.17 2001-06-25 13:30:57 remacle Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Geo.h" #include "Geo.h"
...@@ -144,11 +144,11 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){ ...@@ -144,11 +144,11 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){
switch(Type){ switch(Type){
case LGN1: case LGN1:
simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL); //simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL);
simp->Num = Num ; //simp->Num = Num ;
simp->iEnt = Elementary ; //simp->iEnt = Elementary ;
Tree_Insert(c->Simplexes, &simp) ; //Tree_Insert(c->Simplexes, &simp) ;
Tree_Insert(M->Simplexes, &simp) ; //Tree_Insert(M->Simplexes, &simp) ;
break; break;
case TRI1: case TRI1:
simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL); simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment