delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Date: | Wed, 25 Aug 2004 19:16:45 +0200 |
From: | "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de> |
Reply-To: | "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de> |
Organization: | Esse keine toten Tiere |
Message-ID: | <11845274424.20040825191645@familiehaase.de> |
To: | Luke Stras <stras AT utias DOT utoronto DOT ca> |
CC: | cygwin AT cygwin DOT com |
Subject: | Re: Trouble with std::vector in g++ |
In-Reply-To: | <20040825164918.GF9503@arrow.utias.utoronto.ca> |
References: | <20040825164918 DOT GF9503 AT arrow DOT utias DOT utoronto DOT ca> |
MIME-Version: | 1.0 |
Luke wrote: > I am having some trouble with the std::vector class in g++ 3.3.3. If I > compile the following program and run it, it segfaults in the call to > push_back; reducing the array in Solution to 512*1024 makes the code run > OK. > If I compile it with g++ 3.2.1 under Linux, the program runs fine. > Is it just my misunderstanding of how the STL works, or is there a > compiler/library problm here? > vvv begin code vvv > #include <vector> > class Solution { > public: > char se[1024*1024]; > }; > class Element { > public: > Solution s; > }; > typedef std::vector<Element> element_list_t; > class Mesh { > public: > element_list_t elements; > }; > int > main() > { > Mesh *mesh = new Mesh; > Element el; > mesh->elements.push_back(el); > return 0; > } > ^^^ end code sample ^^^ > compile with: > $ g++ -Wall -o etest etest.cc > $ ./etest > Segmentation fault (core dumped) Increase the stack: g++ -Wall -Wl,--stack=8000000 -o etest etest.cc This works for me with gcc-3.4.1(tm). The default stack for Cygwin executables is 2MB which seems to be too small for your program. Gerrit -- =^..^= http://nyckelpiga.de/donate.html -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |