Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

malloc size limit

Hi,

on my board I've more than 8000 KB of free RAM.

From my application I try to malloc a big buffer in RAM, ~5000KB, but I see that the malloc function don't give me this memory space.

I made some test and I've seen that the maximal block of memory that I can to alloc is

~4194055 Bytes.

Why? Is there an allocation limit?

Can somebody help me?

thanks

StePa

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There is no MMU support here.

    Even you have a lot free memory, they may be fragmented.

    You should allocate in smaller chunks, and make a list of them.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks hippo,

    I've tried to malloc in smaller blocks. It's work better, but I see that if the malloc failed, after some tries the kernel kill my application.

    How do I have to set the overcommit_memory and overcommit_ratio in

    /proc/sys/vm ?

    Which other kernel parameter have I to set, so that my system works properly, and to avoid that my applications are killed from the OOM_KILLER?

    Can somebody help me?

    thanks

    StePa
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by stepa@Dec 6 2005, 02:31 AM

    thanks hippo,

    i've tried to malloc in smaller blocks. it's work better, but i see that if the malloc failed, after some tries the kernel kill my application.

    how do i have to set the overcommit_memory and overcommit_ratio in

    /proc/sys/vm ?

    which other kernel parameter have i to set, so that my system works properly, and to avoid that my applications are killed from the oom_killer?

    can somebody help me?

    thanks

    stepa

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11342)

    --- quote end ---

    --- Quote End ---

    not sure if this is related, but there is a parameter in the kernel configure menu that allows the allocation of &#39;large&#39; blocks of memory - make sure that is on.