valloc has failed even though memory is availible - VxWorks

This is a discussion on valloc has failed even though memory is availible - VxWorks ; I am getting a strange problem from valloc() function. My board has a 256MB of RAM and one of my application is trying to allocate 200KB of memory block by using valloc. But valloc has failed to allocate the memory ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: valloc has failed even though memory is availible

  1. valloc has failed even though memory is availible

    I am getting a strange problem from valloc() function. My board has a
    256MB of RAM and one of my application is trying to allocate 200KB of
    memory block by using valloc. But valloc has failed to allocate the
    memory block of 200KB size.

    I have already attached a hook to the vxworks (memPartAllocErrorRtn)
    for memory allocation failure. So, my hook gets called by vxworks if
    memory allocation fails because of some reason.

    In my hook, I am getting system memory partition details by using
    memPartInfoGet() function and printing the no.of free bytes available
    and the maximum size of a free block available for debugging purpose.

    Now the issue is, vxworks (partition details from the
    memPartInfoGet() ) is telling 170MB of RAM is available and the
    maximum size of a available free block is nearly 16MB (0x00ffeff8).

    If vxworks has the free block of nearly 16MB, why it has failed to
    allocate a block of 200KB.

    Does anybody come across a problem like this?

    Thanks,
    Nari.


  2. Re: valloc has failed even though memory is availible

    On Jul 24, 2:02 pm, naresh.ganapathine...@gmail.com wrote:
    > I am getting a strange problem from valloc() function. My board has a
    > 256MB of RAM and one of my application is trying to allocate 200KB of
    > memory block by using valloc. But valloc has failed to allocate the
    > memory block of 200KB size.
    >
    > I have already attached a hook to the vxworks (memPartAllocErrorRtn)
    > for memory allocation failure. So, my hook gets called by vxworks if
    > memory allocation fails because of some reason.
    >
    > In my hook, I am getting system memory partition details by using
    > memPartInfoGet() function and printing the no.of free bytes available
    > and the maximum size of a free block available for debugging purpose.
    >
    > Now the issue is, vxworks (partition details from the
    > memPartInfoGet() ) is telling 170MB of RAM is available and the
    > maximum size of a available free block is nearly 16MB (0x00ffeff8).
    >
    > If vxworks has the free block of nearly 16MB, why it has failed to
    > allocate a block of 200KB.
    >
    > Does anybody come across a problem like this?
    >
    > Thanks,
    > Nari.


    -------------------------------------------------------------------------------------------------------
    Hi,

    I gone through ur queries. Actually valloc() function is used to
    allocate memory block which should be within page boundary range. This
    page boundary range is dependent of the underlying architecture.

    What is ur underlying architecture?
    Check the default page size for the arch? You can get the page size
    using function, vxBasePageSizeGet().
    And then try to allocate memory block of size which is less than
    default page size.

    Regards,
    Giri.


+ Reply to Thread