Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #8573
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!goblin1!goblin2!goblin.stu.neva.ru!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | ittium <ittium@gmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: STL container and stack frame size |
| Date | Tue, 09 Aug 2011 10:12:58 +0530 |
| Organization | A noiseless patient Spider |
| Lines | 23 |
| Message-ID | <4E40BAD2.9050002@gmail.com> (permalink) |
| References | <6ebc4e08-8383-4284-982c-d84d1045266a@a2g2000prf.googlegroups.com> <4e3aaad2$0$2832$7b1e8fa0@news.nbl.fi> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx04.eternal-september.org; posting-host="Jr+GCtWa+XbvmSdRpa1MLQ"; logging-data="6952"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jlwx37aK3GaXmuLQnyY+0" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
| In-Reply-To | <4e3aaad2$0$2832$7b1e8fa0@news.nbl.fi> |
| Cancel-Lock | sha1:Ks6h+K6GKRIcUZQEcJDkXaOK7bU= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:8573 |
Show key headers only | View raw
On 04-08-2011 PM 07:51, Juha Nieminen wrote:
> itt ium<ittium@gmail.com> wrote:
>> if the vector is of big size, making a local variable will occupy lot
>> of stack space and may result in stack overflow.
>
> Nope. There's a very simple way of seeing how much stack space an
> object takes, namely:
>
> void foo()
> {
> std::vector<int> v(10000);
> std::cout<< "v is taking "<< sizeof(v)<< " bytes of stack space.\n";
> }
>
> Here it says "v is taking 12 bytes of stack space."
>
> The rest is allocated on the heap.
This means, we really do not have any situation, where we should define
STL containers with pointers. Container with normal variables are
sufficient for most of the cases.
Ittium
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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