public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* large memory allocation via new causes segmentation fault in G++ compiled programs
@ 2000-08-07 12:19 Bruce Rosen
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Rosen @ 2000-08-07 12:19 UTC (permalink / raw)
  To: cygwin; +Cc: Bruce Rosen

I'm running cygwin on a WINNT PIII machine with 785 meg of memory. The
program below compiles
without error both in g++ and MSVC6.0. The MSVC compile executable runs
correctly, but the
G++ compiled executable gives me a segmentation fault (returning 0 from new)
when over 128 meg
of memory is allocated.
 Is there some way to correct the error?  Here is the program:

int main()
{
char *p;
        // allocate 150,000,000 bytes > 128 Meg limit
        p = new char[150000000];
        p[50] = 'a';
}

And here are the g++ parameters:

 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2/cpp.exe -lang-c -v -iprefix
/bin/../l
ib/gcc-lib/i686-pc-cygwin/2.95.2/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -D
_X86
=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribu
te__
((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D_X86=1 -D__STD
C__=
1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl_
_))
-D__declspec(x)=__attribute__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Ama
chin
e(i386) -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686
 -Dp
entiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__CYGWIN32__
 -D_
_CYGWIN__ -Dunix -D_WIN32 -DWINNT --help help-dummy /tmp/ccgw0dun.i
GNU CPP version 2.95.2 19991024 (release-2) (80386, BSD syntax)


 /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2/collect2.exe -Bdynamic --help
/usr/li
b/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib/crt0.o -L/bin
/../
lib/gcc-lib/i686-pc-cygwin/2.95.2 -L/bin/../lib/gcc-lib -L/usr/lib/gcc-lib/i
686-
pc-cygwin/2.95.2 -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-p
c-cy
gwin/lib
/tmp/ccCJG2dS.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32
-lshell32 -lgcc


    Any help would be appreciated.
    thanks
    bruce
Here is the cygcheck output:

cygcheck

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Aug 07 12:19:10 2000

WinNT Ver 4.0 build 1381 Service Pack 4

Path:
        .
        /usr/local/bin
        /bin
        /WINNT/system32
        /WINNT
        /Program Files/Mt

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

HOME = `/WINNT/Profiles/rosen/Desktop'
MAKE_MODE = `unix'
PWD = `/WINNT/Profiles/rosen/Desktop/cyg'
USER = `administrator'

Use `-r' to scan registry

a:  fd           N/A    N/A
c:  hd  NTFS    4000Mb  95% CP CS UN PA FC
d:  cd  CDFS     498Mb 100%    CS              TIPSTER_VOL_1
e:  hd  NTFS   10660Mb  19% CP CS UN PA FC
x:  net NTFS   16159Mb  73% CP CS UN PA FC

C:\\bin  /usr/bin  user    binmode
C:\\lib  /usr/lib  user    binmode
C:    /        user    binmode

Found: C:\bin\bash.exe
Found: \bin\bash.exe
Found: C:\bin\cat.exe
Found: \bin\cat.exe
Found: C:\bin\cpp.exe
Found: \bin\cpp.exe
Found: C:\bin\find.exe
Found: \bin\find.exe
Found: C:\bin\gcc.exe
Found: \bin\gcc.exe
Found: C:\bin\gdb.exe
Found: \bin\gdb.exe
Found: C:\bin\ld.exe
Found: \bin\ld.exe
Found: C:\bin\ls.exe
Found: \bin\ls.exe
Found: C:\bin\make.exe
Found: \bin\make.exe
Found: C:\bin\sh.exe
Found: \bin\sh.exe

   83k 2000/06/11 C:\bin\cygitcl30.dll
   35k 2000/06/11 C:\bin\cygitk30.dll
  402k 2000/06/11 C:\bin\cygtcl80.dll
    5k 2000/06/11 C:\bin\cygtclpip80.dll
   10k 2000/06/11 C:\bin\cygtclreg80.dll
 639k 2000/06/11 C:\bin\cygtk80.dll
 587k 2000/03/01 C:\bin\cygwin1.dll
   Cygwin DLL version info:
       dll major: 1001
       dll minor: 0
       dll epoch: 19
       dll bad signal mask: 19005
       dll old termios: 00005
       api major: 0
       api minor: 17
       shared data: 3
       dll identifier: cygwin1
       mount registry: 2
       cygnus registry name: Cygnus Solutions
       cygwin registry name: Cygwin
       program options name: Program Options
       cygwin mount registry name: mounts v2
       build date: Wed Mar 1 00:15:19 EST 2000
       snapshot date: 2000-02-29-23:55-EST
       shared id: cygwin1S3-2000-03-01 00:15:19

Bruce Rosen, Ph.D.
Chief Scientist, Oingo Inc
10474 Santa Monica Bl.
Los Angeles, CA 90025
Phone: (310) 446 8162
E-mail: rosen@oingo.com
----------------------------------------------------------------------------
------------

The information contained in this email is Confidential, and is intended for
the recipient's review only. Any unauthorized review, use, disclosure or
distribution is not allowed. If you are not the intended recipient, please
contact the sender by email and destroy all copies of the original message.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: large memory allocation via new causes segmentation fault in G++  compiled programs
@ 2000-08-10  9:18 Earnie Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Earnie Boyd @ 2000-08-10  9:18 UTC (permalink / raw)
  To: dwsharp, cygwin

--- Don Sharp <Don.Sharp@dddandr.octacon.co.uk> wrote:
> 
> 
> Earnie Boyd wrote:
> > 
> > --- Bruce Rosen <rosen@oingo.com> wrote:
> > >
> > > C:\\bin  /usr/bin  user    binmode
> > > C:\\lib  /usr/lib  user    binmode
> > > C:    /        user    binmode
> > >
> > 
> > This is the second case I've seen of this bug, I'm speaking of the C:\\bin
> and
> > C:\\lib.  Although fixing this problem won't help this one you should
> however
> > do:
> > 
> > mount -f -b C:/bin /usr/bin
> > mount -f -b C:/lib /usr/bin
>                  ^^^      ^^^

Sorry, that should be `mount -f -b C:/lib /usr/lib'.

> 
> Do you really mean this? Won't one obscure the other?
> 

No, see above.

> Wonderingly
> 

Thanks for wondering.

> Don
> 
> > 
> > Cheers,


=====
---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: large memory allocation via new causes segmentation fault in G++ compiled programs
  2000-08-10  6:48 Earnie Boyd
@ 2000-08-10  7:44 ` Don Sharp
  0 siblings, 0 replies; 5+ messages in thread
From: Don Sharp @ 2000-08-10  7:44 UTC (permalink / raw)
  To: cygwin

Earnie Boyd wrote:
> 
> --- Bruce Rosen <rosen@oingo.com> wrote:
> >
> > C:\\bin  /usr/bin  user    binmode
> > C:\\lib  /usr/lib  user    binmode
> > C:    /        user    binmode
> >
> 
> This is the second case I've seen of this bug, I'm speaking of the C:\\bin and
> C:\\lib.  Although fixing this problem won't help this one you should however
> do:
> 
> mount -f -b C:/bin /usr/bin
> mount -f -b C:/lib /usr/bin
                 ^^^      ^^^

Do you really mean this? Won't one obscure the other?

Wonderingly

Don

> 
> Cheers,
> 
> =====
> ---
>    Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
>             __Cygwin: POSIX on Windows__
> Cygwin Newbies: < http://gw32.freeyellow.com/ >
>            __Minimalist GNU for Windows__
>   Mingw32 List: < http://www.egroups.com/group/mingw32/ >
>     Mingw Home: < http://www.mingw.org/ >
> 
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: large memory allocation via new causes segmentation fault in G++ compiled programs
@ 2000-08-10  6:48 Earnie Boyd
  2000-08-10  7:44 ` Don Sharp
  0 siblings, 1 reply; 5+ messages in thread
From: Earnie Boyd @ 2000-08-10  6:48 UTC (permalink / raw)
  To: Bruce Rosen, cygwin; +Cc: Bruce, UNEXPECTED_DATA_AFTER_ADDRESS

--- Bruce Rosen <rosen@oingo.com> wrote:
> 
> C:\\bin  /usr/bin  user    binmode
> C:\\lib  /usr/lib  user    binmode
> C:    /        user    binmode
> 

This is the second case I've seen of this bug, I'm speaking of the C:\\bin and
C:\\lib.  Although fixing this problem won't help this one you should however
do:

mount -f -b C:/bin /usr/bin
mount -f -b C:/lib /usr/bin

Cheers,

=====
---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: large memory allocation via new causes segmentation fault in G++ compiled programs
@ 2000-08-08  0:41 NOE Nicolas
  0 siblings, 0 replies; 5+ messages in thread
From: NOE Nicolas @ 2000-08-08  0:41 UTC (permalink / raw)
  To: cygwin

Hello,

I've raised the same problem some time ago on the list. I haven't
seen any answer on the list, but I've found a way to solve it. By the
way, I'm still interested in other people explanations !

Here's my answer, hope it helps !

>>Hello,
>>
>>I'm using cygwin & gcc on a 512 Mb PC running NT, and
>>it seems that I cannot allocate more than (roughly)
>>128 MegaBytes of total memory (either with a single 
>>malloc call, or with lots of them). Is there's a memory 
>>allocation limit in cygwin & gcc or am I missing something ? 
>>
>>(the same program works fine with Watcom C, and I'm using
>>cygwin latest release)
>>
>>Thanks in advance if anyone can help !
>>
>>Nicolas
>
>Hi again,
>
>I can't fully answer my question, but I've found a way to malloc
>more than 128 Mb. I've read than cygwin uses Doug Lea's malloc
>( http://gee.cs.oswego.edu/pub/misc/malloc.c ), and I've compiled 
>it and linked it with my programs, and then, it works. 
>
>For instance, the following program fails if compiled with gcc, 
>and works when linked with Doug Lea's malloc.
>
>#include <stdlib.h>
>#include <assert.h>
>
>int main(void)
>{
>	void	*p = malloc(128 * 1024 * 1024);
>	assert(p);
>	return 0;
>}
>
>Using that other malloc solves my problem, but I'd still like to
>know if it's something wrong with my system or a problem with gcc.
>
>Nicolas

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-08-10  9:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-07 12:19 large memory allocation via new causes segmentation fault in G++ compiled programs Bruce Rosen
2000-08-08  0:41 NOE Nicolas
2000-08-10  6:48 Earnie Boyd
2000-08-10  7:44 ` Don Sharp
2000-08-10  9:18 Earnie Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).