[geos-devel] Re: [Valgrind-users] STL: unguarded_linear_insert

strk strk at keybit.net
Wed Apr 28 12:02:09 EDT 2004


On request, this is more valgrind output:

==12560== Invalid read of size 4
==12560==    at 0x3C0AFAA3: void std::__unguarded_linear_insert<__gnu_cxx::__nor
mal_iterator<geos::Boundable**, std::vector<geos::Boundable*, std::allocator<geo
s::Boundable*> > >, geos::Boundable*, bool (*)(geos::Boundable*, geos::Boundable
*)>(__gnu_cxx::__normal_iterator<geos::Boundable**, std::vector<geos::Boundable*
, std::allocator<geos::Boundable*> > >, geos::Boundable*, bool (*)(geos::Boundab
le*, geos::Boundable*)) (stl_iterator.h:602)
==12560==    by 0x3C0AF78C: _ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_i
teratorIPPN4geos9BoundableESt6vectorIS4_SaIS4_EEEEPFbS4_S4_EEvT_SC_T0_ (stl_iter
ator.h:602)
==12560==    by 0x3C0B12B0: geos::STRtree::createParentBoundables(std::vector<ge
os::Boundable*, std::allocator<geos::Boundable*> >*, int) (stl_algo.h:2212)
==12560==    by 0x3C0AF088: geos::AbstractSTRtree::createHigherLevels(std::vecto
r<geos::Boundable*, std::allocator<geos::Boundable*> >*, int) (AbstractSTRtree.c
pp:133)

And this is the code where 'sort' is called:

vector<Boundable*>*
STRtree::createParentBoundables(vector<Boundable*> *childBoundables, int newLevel)
{
        Assert::isTrue(!childBoundables->empty());
        int minLeafCount=(int) ceil((double)childBoundables->size()/(double)getNodeCapacity());
        vector<Boundable*> *sortedChildBoundables=new vector<Boundable*>(childBoundables->begin(),childBoundables->end());
        sort(sortedChildBoundables->begin(),sortedChildBoundables->end(),xComparator);
 

Commenting out the 'sort' call algorithm is broken, but I don't get
segmentation faults.

--strk;


On Wed, Apr 28, 2004 at 05:46:21PM +0200, David Eriksson wrote:
> On Wed, 2004-04-28 at 17:30, strk wrote:
> > I've got the following error from valgrind:
> > 
> > ==26245== Invalid read of size 4
> > ==26245==    at 0x3C0AFB23: void std::__unguarded_linear_insert<__gnu_cxx::__nor
> > mal_iterator<geos::Boundable**, std::vector<geos::Boundable*, std::allocator<geo
> > s::Boundable*> > >, geos::Boundable*, bool (*)(geos::Boundable*, geos::Boundable
> > *)>(__gnu_cxx::__normal_iterator<geos::Boundable**, std::vector<geos::Boundable*
> > , std::allocator<geos::Boundable*> > >, geos::Boundable*, bool (*)(geos::Boundab
> > le*, geos::Boundable*)) (stl_iterator.h:602)
> > ==26245==    by 0x3C0AF80C: _ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_i
> > teratorIPPN4geos9BoundableESt6vectorIS4_SaIS4_EEEEPFbS4_S4_EEvT_SC_T0_ (stl_iter
> > ator.h:602)
> > 
> > Can anybody help me understanding the circumstances in which
> > this happen ?
> 
> In order for you to get help I suggest you provide more of the valgrind
> output and relevant parts of source code.
> 
> -- 
> Regards,
>                -\- David Eriksson -/-
> 
>         SynCE - http://synce.sourceforge.net
>        CalcEm - http://calcem.sourceforge.net
>       ScummVM - http://scummvm.sourceforge.net
>      Desquirr - http://desquirr.sourceforge.net
>   SetiWrapper - http://setiwrapper.sourceforge.net



More information about the geos-devel mailing list