patchAVR C Runtime Library - Patches: patch #6935, Patch for malloc()


You are not allowed to post comments on this tracker with your current authentication level.

patch #6935: Patch for malloc()

Submitted by:  Michael Baeuerle <micha123>
Submitted on:  Tue 06 Oct 2009 08:11:37 AM UTC  
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  Joerg Wunsch <joerg_wunsch> Open/Closed:  Closed

Tue 08 Jun 2010 01:47:00 PM UTC, comment #3: 

OK, we can close this then.

Please test the rewritten implementation to see whether it
works the way you expect it to.  I wrote some test scripts,
too, but the more people look at it, the better.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 08 Jun 2010 01:40:40 PM UTC, comment #2: 

The problem was that the memory beyond the last used chunk was not always available. If malloc() is called with a size that fits after the last used chunk but is larger than every block in the freelist and larger than the unused space beyond the freelist, the request was rejected.
The patch let malloc() delete the last block from the freelist before the new chunk is allocated.
If free() can now ensure that the freelist always end before the last used chunk, this situation can no longer occur and this patch for malloc() is not needed.

Michael Baeuerle <micha123>
Tue 08 Jun 2010 11:14:30 AM UTC, comment #1: 

I reimplemented some parts of free() yesterday, so __brkval
is now lowered again when freeing the topmost chunk of
memory.  Please tell me whether your patch would still be

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 06 Oct 2009 08:11:37 AM UTC, original submission:  

This patch is for avr-libc 1.6.7. It allows malloc() to combine new memory from heap extension with the last block in the freelist (if there are no used blocks in between).

Michael Baeuerle <micha123>


Attached Files
file #18819:  malloc_patch added by micha123 (2KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by micha123 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-06-08 joerg_wunsch StatusNeed Info => Wont Do
        Open/ClosedOpen => Closed
    2010-06-08 joerg_wunsch StatusNone => Need Info
        Assigned toNone => joerg_wunsch
    2009-10-06 micha123 Attached File- => Added malloc_patch, #18819

    Back to the top

    Powered by Savane 3.5