Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8462

Re: STL container and stack frame size

From "Paul" <pchristor@yahoo.co.uk>
Newsgroups comp.lang.c++
Subject Re: STL container and stack frame size
Date 2011-08-04 13:14 +0100
Organization Netfront http://www.netfront.net/
Message-ID <j1e2f8$2e1t$1@adenine.netfront.net> (permalink)
References <6ebc4e08-8383-4284-982c-d84d1045266a@a2g2000prf.googlegroups.com>

Show all headers | View raw


"itt ium" <ittium@gmail.com> wrote in message 
news:6ebc4e08-8383-4284-982c-d84d1045266a@a2g2000prf.googlegroups.com...
> Group,
> This might be a very obvious question but a simple google search did
> not reveal much. I am designing a software where different functions
> make local copies of vectors, map and hash map containing big size
> structures. I was concerned about following
>
> if the vector is of big size, making a local variable will occupy lot
> of stack space and may result in stack overflow.
The size of the structure won't affect the size of a STL container. STL 
containers, by default, allocate on the heap.
The number of elements will increase the size of a vector but this is not 
multiplied by the sizeof(structure), it is multiplied by sizeof (pointer to 
structrue).

HTH
Paul.


--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

STL container and stack frame size itt ium <ittium@gmail.com> - 2011-08-04 03:13 -0700
  Re: STL container and stack frame size "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-04 12:19 +0200
  Re: STL container and stack frame size "Paul" <pchristor@yahoo.co.uk> - 2011-08-04 13:14 +0100
    Re: STL container and stack frame size "Paul" <pchristor@yahoo.co.uk> - 2011-08-05 21:34 +0100
  Re: STL container and stack frame size Juha Nieminen <nospam@thanks.invalid> - 2011-08-04 14:21 +0000
    Re: STL container and stack frame size ittium <ittium@gmail.com> - 2011-08-09 10:12 +0530
      Re: STL container and stack frame size Ian Collins <ian-news@hotmail.com> - 2011-08-09 16:49 +1200
      Re: STL container and stack frame size Asger-P <junk@asger-p.dk> - 2011-08-09 09:25 +0200

csiph-web