Re: Strange "Stack Overflow" message occurring with use of vector
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Thu, 11 Jan 2007 08:56:19 -0500
"ralphey" <Trapp.Andrew@xxxxxxxxx> wrote in message
news:1168490662.609154.101710@xxxxxxxxxxxxxxxxxxxxxxxxxxx
The only time I add elements to the vector is in a function which is
called recursively, and to do this I am passing the vector to the
function via reference (using the & operator); furthermore, the
recursion can be expected to run many (in the 1000's of) times in my
code.
I suspect the stack overflow has nothing to do with the vector, and
everything to do with running a recursive function 1000 levels deep. You
simply run out of stack for local variables. Replace your recursion with
iteration, possibly with an explicitly maintained stack.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to make a variable unique in the program?
- Next by Date: Re: Creating thread from a class object
- Previous by thread: Re: Strange "Stack Overflow" message occurring with use of vector
- Next by thread: Re: Strange "Stack Overflow" message occurring with use of vector
- Index(es):
Relevant Pages
|