[Paraview] PV and the STL: memory allocation issue
Fred Fred
stan1313 at hotmail.fr
Fri Sep 18 06:28:10 EDT 2009
Yes this is exactly what I want.
The aim of this data structure is to maintain, for each pixel of an image, a list (which could be empty) of all points included in the corresponding area (ie (x,y,z) lists, which are coded as vtkstd::vector<double>).
So later in the code I initialize this structure as follow:
fill(this->grid.begin(), this->grid.end(), vtkstd::vector<vtkstd::vector<double> >());
and then I add points in each list as follow:
vtkstd::vector<double> pt2D;
pt2D.push_back(pt[0]);
pt2D.push_back(pt[1]);
this->grid[*it].push_back(pt2D);
One more time, something may be wrong but it works well with VTK.
Date: Thu, 17 Sep 2009 20:01:25 +0100
Subject: Re: [Paraview] PV and the STL: memory allocation issue
From: paul.m.edwards at gmail.com
To: stan1313 at hotmail.fr
CC: berk.geveci at kitware.com; paraview at paraview.org
I think there is another problem with your code and it just fails in that place - you are probably overwriting memory somewhere. By having a vector<vector<vector<double> > > > and then just allocating the first to size of x*y, you will result in a vector or length x*y each containing empty vector<vector<double> >'s. Are you sure this is what you want? (if that makes sense)
If you post the code I will look.
Regards,Paul
2009/9/17 Fred Fred <stan1313 at hotmail.fr>
Yes this is exactly the line of code that fails, I put printf();getchar(); items before and after (sorry I do not use a debugger).
Ok I may send the code but I doubt it could help because, this line is clear and I checked the argument (=100), so what?
Date: Thu, 17 Sep 2009 16:34:29 +0100
Subject: Re: [Paraview] PV and the STL: memory allocation issue
From: paul.m.edwards at gmail.com
To: stan1313 at hotmail.fr
CC: berk.geveci at kitware.com; paraview at paraview.org
Are you running this through a debugger? And, is that the line that it is failing on? Finally, can you post the PV code that is failing?
Regards,
Paul
2009/9/17 Fred Fred <stan1313 at hotmail.fr>
Hmmm, doubtful since in my test this->grid_xsize == this->grid_ysize == 10 !!
> Date: Thu, 17 Sep 2009 08:11:43 -0400
> Subject: Re: [Paraview] PV and the STL: memory allocation issue
> From: berk.geveci at kitware.com
> To: stan1313 at hotmail.fr
> CC: paraview at paraview.org
>
> In all likelihood, the allocation is failing because the process is
> unable to allocate the memory you ask it to. I am not surprised that
> this happens in ParaView not in VTK because ParaView tends to
> allocate a fair number of small objects probably segmenting the memory
> somewhat. Did you try a 64 bit ParaView?
>
> On Wed, Sep 16, 2009 at 11:16 AM, Fred Fred <stan1313 at hotmail.fr> wrote:
> > I use the STL through vtkstd:
> >
> > vtkstd::vector<vtkstd::vector<vtkstd::vector<double> > > grid;
> > [...]
> > this->grid.clear();
> > this->grid = vtkstd::vector<vtkstd::vector<vtkstd::vector<double> >
> >>(this->grid_xsize*this->grid_ysize);
> >
> > It works well on VTK but on PV I can this error at run time:
> >
> > terminate called after throwing an instance of 'std::bad_alloc'
> > what(): St9bad_alloc
> >
> > If I change the initialization line by:
> >
> > this->grid.resize(this->grid_xsize*this->grid_ysize);
> >
> > I get another message:
> >
> > terminate called after throwing an instance of 'std::length_error'
> > what(): vector::_M_fill_insert
> >
> > which means that the memory allocation by the vtkstl library crashes.
> > Does anybody know about this issue?
> >
> >
> > ________________________________
> > Un avatar à votre image ? Créez votre mini-moi !
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> >
> >
Vous cherchez l'intégrale des clips de Michael Jackson ? Bing ! Trouvez !
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus
_________________________________________________________________
Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie !
http://www.portable-windows.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090918/59436598/attachment.htm>
More information about the ParaView
mailing list