This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Re: Help! cygwin's malloc does not work



> Basically, it looks like cygwin can not handle large memory allocations.

Open regedit (or regedt32) and find the key
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\

Create a new DWORD value there called "heap_chunk_in_mb" that contains
the maximum amount of memory (in Mb) your application needs (watch the
hex/decimal toggle).  Exit and restart all cygwin applications.

The default is 128 (i.e. 128Mb) if no registry key is set.

Here is a more interesting "max memory" program:

main()
{
  unsigned int bit=0x40000000, sum=0;
  char *x;

  while (bit > 4096) {
    x = malloc(bit);
    if (x)
      sum += bit;
    bit >>= 1;
  }
  printf("%08x bytes (%.1fMb)\n", sum, sum/1024.0/1024.0);

  return 0;
}

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


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