Skip to contentSkip to conversation

Malloc returns non valid adress

DISCUSSION Reni Pachernegg 1 participant 1 message Jul 28, 2000

lore
Share & tools
lore
#0 lore raw

Hi everybody,

Im using the kernel version 2.14 on a special embedded ppc-system. The livefs is copied from a flash-card to a ramdisk of 6MB. Total memory is 16 MB.
I found the following error:
When trying to alloc more memory than available alloc is returning an
adress as if everything was ok.
When trying to access the memory it hangs up with an infinite loop of
page fault exceptions.
I drag everything down to the function vm_enough_memory in mmap.c, where the amount of free mem is calculated by adding buffermem >> PAGE_SHIFT (later versions: buffermem_pages). Buffermem is exactly set to the size of the ramdisk, which means the ramdisk is treated like any block buffer whiche can be freed any time if needed.
When I set :
free = 0
instead of
free = buffermem
everything works ok and malloc returns NULL whenever there isnt enough memory available.
I suppose this is neither the best solution nor the real reason for the error.
Could anybody give me a hint where to search for it ro what to do?

regards Rene

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/