www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/04/05:48:42

Message-Id: <199608040944.AA02455@sun17.thp.Uni-Koeln.DE>
From: brenig AT thp DOT Uni-Koeln DOT DE (Wolfram Brenig)
Date: Sun, 4 Aug 1996 11:44:26 +0200
To: djgpp AT delorie DOT com
Subject: DJGPP+STL problem

Hi,
anybody out there who would like to explain to me what is wrong
with DJGPP's STL-lib in connection with the code-caricature below?

I have to construct a vector<vector<int> >. At certain sizes of
this thing, *which are, admittedly, large but way below the maximum
size possible*, I experience strange run-time crashes due to
segmentation violations.  The particular size set in the code below
is only an example and I have not tested what are the limiting
errorness conditions for i,j. I have compiled and run the code on
different machines with very different memory configurations - the
problem remains.

So here's the code:

#include <vector.h>
int main() {
	int i=360,j=10000;

	// construct a vector of j 1-s
	vector<int> V(j,1);

	// construct a vector of i of the above vectors of j 1-s: Error!
	vector<vector<int> > VV(i,V);

	return 0;
}

compile it with 'gcc -g f.cc -lstdcxx' and that's the type of error you get:

Exiting due to signal SIGSEGV
Page fault at eip=00010678, error=0006
eax=01850ffc ebx=00000000 ecx=00011000 edx=01850ffc esi=00010000 edi=0000000d
ebp=0005fa28 esp=0005fa18 cs=00a7 ds=00af es=00af fs=008f gs=00bf ss=00af
Call frame traceback EIPs:
  0x00010678   _malloc+308
  0x000105f5   _malloc+177
  0x0000f6d6   ___builtin_new+42
  0x00003138   _allocate__FiPi+40, line 50 of f6.cc
  0x000030ff   _allocate__t9allocator1ZiUl+15, line 138 of f6.cc
  0x00002f7b   ___t6vector1ZiRCt6vector1Zi+51, line 91 of f6.cc
  0x00002ceb   _construct__FPt6vector1ZiRCt6vector1Zi+31, line 123 of f6.cc
  0x000016b5   _uninitialized_fill_n__FPt6vector1ZiUlRCt6vector1Zi+37, line 146
of f6.cc3232
  0x00001582   _main+70, line 6 of f6.cc
  0x00010093   ___crt1_startup+115


Seems that the error is an allocation problem within the .... ???
What wrong here?

Any help is most appreciated. I am not subscribing to the djgpp mailing
list so please mail your comments to: brenig AT thp DOT uni-koeln DOT de

Thanks, :-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019