[gts-general] gts_surface_intersection memory leak
Brought to you by:
popinet
|
From: Michele C. <mic...@un...> - 2013-06-11 08:49:20
|
Hi everybody,
I am using extensively using boolean operation within my code. In particular, I am at the moment interested in the evaluation of the line of intersection among two objects.
For this, I use gts_surface_intersection. Unfortunately, I encountered some problem while deallocating memory.
In what follow you may find a simple example code showing the memory leak I have found. Am i doing something wrong? Or if the function gts_surface_intersection creating copies of the original surfaces that I am not deleting?
Thank you in advance
Michele
------------------------------------------------------
#include <vtkPolyData.h>
#include <vtkSTLReader.h>
#include "VTK-GTS_Converter.h"
int main( int argc, char *argv[] )
{
vtkPolyData *data1 = vtkPolyData::New();
vtkPolyData *data2 = vtkPolyData::New();
vtkSTLReader *volumeReader1 = vtkSTLReader::New();
volumeReader1->SetFileName("obj1.stl");
data1 = volumeReader1->GetOutput();
vtkSTLReader *volumeReader2 = vtkSTLReader::New();
volumeReader2->SetFileName("obj2.stl");
data2 = volumeReader2->GetOutput();
for(int i=0;i<10000;i++)
{
GtsSurface * Surf1 = gts_surface_new ( gts_surface_class (),
GTS_FACE_CLASS (gts_nface_class ()),
GTS_EDGE_CLASS (gts_nedge_class ()),
GTS_VERTEX_CLASS (gts_nvertex_class ()));
GtsSurface * Surf2 = gts_surface_new ( gts_surface_class (),
GTS_FACE_CLASS (gts_nface_class ()),
GTS_EDGE_CLASS (gts_nedge_class ()),
GTS_VERTEX_CLASS (gts_nvertex_class ()));
vtk2gts(data1,Surf1);
vtk2gts(data2,Surf2);
GNode *treeSurf1 = gts_bb_tree_surface(Surf1);
GNode *treeSurf2 = gts_bb_tree_surface(Surf2);
GSList* bord = gts_surface_intersection ( Surf1,
Surf2,
treeSurf1,
treeSurf2);
g_slist_free(bord);
gts_object_destroy(GTS_OBJECT (Surf1));
gts_bb_tree_destroy (treeSurf1,true);
gts_object_destroy(GTS_OBJECT (Surf2));
gts_bb_tree_destroy (treeSurf2,true);
//memory leak!!!!!
}
volumeReader1->Delete();
volumeReader2->Delete();
data1->Delete();
data2->Delete();
return 0;
}
--
Eng. Michele Conconi, Ph.D.
Health Sciences and Technologies - Interdepartmental Center for Industrial Research (HST - ICIR)
Alma Mater Studiorum - University of Bologna
Viale Risorgimento 2, 40136, Bologna, Italy
Email: mic...@un...<mailto:mic...@un...>
Website: http://grab.diem.unibo.it/
Office: (+39) 051 20 93451
Mobile: (+39) 329 0287996
INFORMAZIONE RISERVATA E CONFIDENZIALE
Questo messaggio contiene informazioni riservate e confidenziali.
Se il lettore non fosse il destinatario del messaggio, inoltrato e ricevuto per errore,
il testo dovrà essere immediatamente cancellato dal computer del ricevente.
E' assolutamente proibita qualunque circolazione, disseminazione o
copia del messaggio spedito e/o ricevuto per errore.
CONFIDENTIALITY and WARNING NOTICE
This message may contain legally privileged or confidential information.
If the reader is not the intended recipient, you received this message in error
and it should therefore be deleted from your computer at once.
Any dissemination, distribution and copying of a message
mistakenly sent or received is strictly forbidden.
5x1000 AI GIOVANI RICERCATORI
DELL'UNIVERSITÀ DI BOLOGNA
Codice Fiscale: 80007010376
www.unibo.it/Vademecum5permille
Questa informativa è inserita in automatico dal sistema al fine esclusivo della realizzazione dei fini istituzionali dell’ente.
|