This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Malloc failing too soon under XP/2000

Charles Werner explains this pretty well in:
he also explains how to change the settings



On Wed, 12 Feb 2003, Kris Warkentin wrote:

> I'm running Windows XP with 1/2GB RAM and 2GB swap.  Running Cygwin 1.3.18.
> Consider the following program to use as much memory as possible:
> #include <stdio.h>
> #include <malloc.h>
> int
> main()
> {
>         void *x;
>         unsigned long long mem=0;
>         while((x=malloc(500000)) != NULL){
>                 mem += 500000;
>                 memset(x, 0, 500000);
>                 printf("allocated %u\n", mem);
>         }
>         return 0;
> }
> If I compile and run this, it consistently stops at about 780MB.  If I
> compile with -mno-cygwin, it doesn't fail until almost 2GB have been
> allocated.
> Any comment?  Is there some sort of flag I can compile with to make the
> allocator more aggressive?  The situation it's failing in is one where a
> very large library is being linked and ld is running out of memory in spite
> of quite a bit being available.
> cheers,
> Kris
> --
> Unsubscribe info:
> Bug reporting:
> Documentation:
> FAQ:         

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]