Re: Re: malloc small pieces of memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 2006-06-27 10:26 +0200, Johannes Holzer wrote:
Daniel Skorka schrieb:
> Johannes Holzer <hl.ichaus@xxxxxxxx> 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
_______________________________________________
wine-users mailing list
wine-users@xxxxxxxxxx
http://www.winehq.org/mailman/listinfo/wine-users

Does this program use any other memory allocation functions, like VirtualAlloc(), or mapped files? If it is trying to predict how much memory is available and then allocating address space (without committing it) there might not be enough address space left for new malloc areas. Does the program use threads? How does it determine the stack space requirement for its threads?

There are windows routines that will enumerate the virtual memory allocation. Using them prior to displaying the dialog box may give you a lot more insight into what may be happening. Note that malloc uses these blocks and that it allocates reasonable sized blocks from which to serve up small malloc()s.

_______________________________________________
wine-users mailing list
wine-users@xxxxxxxxxx
http://www.winehq.org/mailman/listinfo/wine-users

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux