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 Document heap chunk in mb

Here is what I have written as a possible contribution for the Users Guide concerning
adjusting the Cygwin memory limit:

Cygwin comes with a maximum program size (program+data) of 384 MB. This means that by default no program can allocate more than this. To run using more real or virtual memory in your machine you must add a entry in the Cygwin HKEY_CURRENT_USER section of the registry. Add the DWORD value heap_chunk_in_mb and set it to desired memory limit in decimal MB using the regtool program included in the Cygwin cygutils package. In this example the limit is set to 1024 MB:

regtool -i set /HKCU/Software/Cygnus\ Solutions/Cygwin/heap_chunk_in_mb 1024
regtool -v list /HKCU/Software/Cygnus\ Solutions/Cygwin

Exit all running Cygwin processes and restart them. Memory can be allocated up to the size of the system swap space minus any the size of any running processes. The system swap should be at least as large as the physically installed RAM and can be modified under the System category in the Control Panel accessible through the Settings tag of the Win32 Start menu.

A program written by DJ Delorie tests the memory allocation limit on your system:

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;

compile using
gcc max_memory.c -o max_memory

Run the program and you will see the maximum memory that can be allocated.

Dr. Charles L. Werner
Gamma Remote Sensing AG
Thunstrasse 130
CH-3074 Muri b. Bern, Switzerland

Tel: +41 31 951 70 05
FAX: +41 31 951 70 08

Unsubscribe info:
Bug reporting:

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