• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » CCSv4 HeapMem_alloc is causing an abort.
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

CCSv4 HeapMem_alloc is causing an abort.

This question is answered
Eddie3909
Posted by Eddie3909
on Nov 29 2011 18:19 PM
Mastermind8070 points

CCSv4.2.4, BIOS 6.31.4.27, IPC 1.22.3.23, Processor C6472

I noticed that HeapMem_alloc causes an abort when asked to allocate more memory than available. I've checked the ti.sysbios.heaps.HeapMem documentation and it does not discuss what happens when there is no heap available. I am stepping through the code and when it steps over HeapMem_alloc(), the abort information is output on the console window.

When I decrease the size of requested LL2 heap, it works fine.

If an abort is the expected response, is there a way to tie our own error callback to the abort?

Cheers

 

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • judahvang
    Posted by judahvang
    on Nov 30 2011 10:49 AM
    Genius16715 points

    Eddie,

    Is the HeapMem_alloc() being called from your code?  if so, you could pass in an error block into the call and it shouldn't abort.  If you pass "NULL" as the error block then it does abort.  There's no callback function you can tie to abort.  You would have to write your own xdc.runtime.ISystemSupport module to do this.

    Judah

    If my reply answers your question please mark the thread as answered

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eddie3909
    Posted by Eddie3909
    on Nov 30 2011 12:51 PM
    Mastermind8070 points

    Ah!

    Could you point me to the documentation on this behavior? I checked in ti.sysbios.heaps.HeapMem

    C:\Program Files\Texas Instruments\bios_6_31_04_27\docs\cdoc\index.html

    Cheers

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Karl Wechsler
    Posted by Karl Wechsler
    on Nov 30 2011 17:56 PM
    Verified Answer
    Verified by Eddie3909
    Mastermind18225 points

    Eddie --

    Do avoid the abort, you should do the following:

     

    {
        Error_Block eb;

        Error_init(&eb);
        ptr = HeapMem_alloc(heap, size, align, &eb);

     

    -Karl-

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eddie3909
    Posted by Eddie3909
    on Apr 05 2012 20:23 PM
    Mastermind8070 points

    Same for HeapMemMP_alloc?

    Cheers

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Steven Connell
    Posted by Steven Connell
    on Apr 09 2012 14:03 PM
    Verified Answer
    Verified by Eddie3909
    Mastermind20600 points

    Eddie,

    Yes, I see that:

    Ptr ti_sdo_ipc_heaps_HeapMemMP_alloc(ti_sdo_ipc_heaps_HeapMemMP_Object *obj, SizeT reqSize, SizeT reqAlign, Error_Block *eb)

    directly calls the XDC runtime function Error_raise(eb, ...), directly passing eb to it.  This is the same behavior as HeapMem_alloc().

    The Error_rasie() function will abort if the error block argument is NULL.

    Steve


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eddie3909
    Posted by Eddie3909
    on Jul 11 2012 16:08 PM
    Mastermind8070 points

    It must be a different IPC version you are using. I get this from the IPC_1_22_03_23 documentation. Unfortunately it does not state what happens when the alloc fails.

    Cheers

    file:///C:/Program%20Files/Texas%20Instruments/ipc_1_22_03_23/docs/doxygen/html/_heap_mem_m_p_8h.html#a04ab3af78110251e5f22f9bc9a961a95

    Void* HeapMemMP_alloc ( HeapMemMP_Handle  handle,
    SizeT  size,
    SizeT  align  
    )

    Allocate a block of memory of specified size and alignment.

    The actual block returned may be larger than requested to satisfy alignment requirements.

    HeapMemMP_alloc will lock the heap using the HeapMemMP gate while it traverses the list of free blocks to find a large enough block for the request.

    Guidelines for using large heaps and multiple alloc() calls.

    • If possible, allocate larger blocks first. Previous allocations of small memory blocks can reduce the size of the blocks available for larger memory allocations.
    • Realize that alloc() can fail even if the heap contains a sufficient absolute amount of unalloccated space. This is because the largest free memory block may be smaller than total amount of unallocated memory.
    Parameters:
    [in]  handle  Handle to previously created/opened instance.
    [in]  size  Size to be allocated (in MADUs)
    [in]  align  Alignment for allocation (power of 2)
    See also:
    HeapMemMP_free
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Karl Wechsler
    Posted by Karl Wechsler
    on Jul 12 2012 15:31 PM
    Mastermind18225 points

    There are 2 APIs for HeapMemMP:

    -  ti/ipc/HeapMemMP is the public interface.  This API is documented with doxygen.  This API is portable to host side (Linux) and DSP side.

    - ti/sdo/ipc/heaps/HeapMemMP is the internal implementation of the public implemenation.  This module has a slightly different API from the public one.

    The ti/ipc/HeapMemMP_alloc() API returns NULL on failure.   I filed a bug report asking that we improve the documentation for this -- SDOCM00094029.

    -Karl-

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use