OT: local variables limited in size to (8*1024*1024-32*1024) bytes ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

the attached program segfaults when using a larger local variable.

Depending on used value I get segfaulst at different locations.

//#define BUFSIZE (9*1024*1024-16*1024) // only segfault
#define BUFSIZE (8*1024*1024-16*1024) // hello + segfault
//#define BUFSIZE (8*1024*1024-32*1024) // hello + 2nd line

When using last definition of BUFSIZE every thing is fine.


stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ ./test
Speicherzugriffsfehler
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ vi test.cc
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ g++   -g  test.cc   -o test
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ ./test
hello
./test: argc = 1
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ vi test.cc
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ g++   -g  test.cc   -o test
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ ./test
hello
Speicherzugriffsfehler
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ ./test
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ ulimit
unlimited
stefan@jarada /home/nfs/extra/src/video/DVB/xlist $ gcc --version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für MARKTGÄNGIGKEIT oder FÜR SPEZIELLE ZWECKE.

-- 
Stefan Lucke
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

//XXX #define BUFSIZE 256*1024
//
//#define BUFSIZE 20*1024*1024
//#define BUFSIZE (9*1024*1024-16*1024) // only segfault
#define BUFSIZE (8*1024*1024-16*1024) // hello + segfault
//#define BUFSIZE (8*1024*1024-32*1024) // hello + 2nd line

#define DUMP 1

#ifdef DUMP
#define DBG(expr) expr;
#else
#define DBG(expr) {} 
#endif

typedef unsigned long tPTS;

int main(int argc, char *argv[])
{
fprintf(stderr, "hello\n");
fprintf(stderr, "%s: argc = %d\n", argv[0], argc);
{
unsigned char a [BUFSIZE];
}
return 1;
}
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux