[Wine] Re: malloc small pieces of memory

Johannes Holzer hl.ichaus at arcor.de
Tue Jun 27 03:26:00 CDT 2006


Daniel Skorka schrieb:
> Johannes Holzer <hl.ichaus at arcor.de> wrote:
>>>> With Linux/Wine, the program fails with an "out of memory"-Error (malloc
>>>> returns NULL).
>>> If it fails, how can you tell its memory usage with top?
>> The programmer was a good one. He checked the returncode of malloc and
>> displays a dialog on failure. (yes, it seems, that there is enough RAM
>> for the dialog.)
> 
> Do I understand correctly that exactly when malloc returns NULL, this
> program uses about 300 MB? In other words, it fails just before it
> finishes mallocing?
> 
The code is the following:

  do
  {
    *ppvHeapPointer = malloc(ui32Size);
    if (*ppvHeapPointer == NULL) A01_vCALL_OUT_OF_MEMORY_FUNCTION();
  } while (*ppvHeapPointer == NULL);


A01_vCALL_OUT_OF_MEMORY_FUNCTION() displays an errormessage with the
buttons "Repeat" and "Cancel". Cancel terminates the process.

ui32Size has a value somewhere between 8 Bytes and 128 Bytes AFAIK.

Johannes Holzer


More information about the wine-users mailing list