Q31559 Allocating More Than 4 Megabytes, Loss of Speed after 32K C Compiler 5.10 | 5.10 MS-DOS | OS/2 Question: I have written a program in C that allocates memory in 32K pieces to see how much memory is available to my program. Malloc returns a null at about 4 megabytes. I thought that I had access to 1 gigabyte of memory with OS/2. Is there a limitation that I do not know about with malloc in OS/2? Also, the system slows down extremely after the first 32K gets allocated. What causes that? Response: Under C Version 5.10, malloc is limited to 64 segment-resource pools, which means malloc can only allocate 4 megabytes of memory under OS/2. This limitation is a constant in the malloc run-time routine and can be raised by modifying the library source code. The speed degradation is caused by malloc scanning the segments for a block of free memory, most of which has been swapped to disk; therefore, performance degradation ("thrashing") occurs as the memory is swapped in and out from disk. Microsoft has confirmed this to be a problem in Version 5.10 of the C compiler. We are researching this problem and will post new information as it becomes available. Keywords: buglist5.10 Updated 88/07/21 03:19