bugAVR C Runtime Library - Bugs: bug #27235, malloc: Several things go wrong

 
 

bug #27235: malloc: Several things go wrong

Submitted by:  Malte <malte>
Submitted on:  Wed 12 Aug 2009 02:54:00 PM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: libc code
Status: FixedPercent Complete: 30%
Assigned to: Joerg Wunsch <joerg_wunsch>Open/Closed: Closed
Release: 1.6.6Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon 07 Jun 2010 06:11:13 PM UTC, comment #6:

I backed out your patch, and instead rewrote free() so it
returns memory from the heap whenever the topmost chunk of
the freelist becomes free. While it increases the codesize
a little, it appears to be the cleanest solution to me.

If you still find any issue with this, please open a new
bug report, preferrably with a test case. Have a look at
the existing testcases to get an idea how they look like.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Mon 07 Jun 2010 02:46:07 PM UTC, comment #5:

Sorry, I confused that with bug #25723.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Mon 07 Jun 2010 02:39:24 PM UTC, comment #4:

Stefan, in bug #27242, you are talking about test cases you've
got for this bug here. I'm interested in getting them into
the tree, if you still have them.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Fri 04 Jun 2010 02:42:50 PM UTC, comment #3:

Patch for first part has been applied, and a testscript has
been added.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 26 Aug 2009 08:58:02 PM UTC, comment #2:

Joerg, you're the most familiar with malloc stuff. Assigning to you.

Eric Weddington <arcanum>
Project Administrator
Thu 13 Aug 2009 01:16:33 PM UTC, comment #1:

I added a patch as a suggestion for topic 1:
http://savannah.nongnu.org/patch/index.php?6895

Stefan Ernst <sternst>
Wed 12 Aug 2009 02:54:00 PM UTC, original submission:

Already discussed here,
http://www.mikrocontroller.net/topic/147150
it looks like there are three behaviors that could be better:

1. If malloc is called and there is only parts of the memory free, empty gaps arise without need:
void * a = s_malloc(34);
a = s_realloc(a, 10);
void * b = s_malloc(34);
Resulting in an unnecessary empty gap between between a and b.

2. If there is RAM for the Heap, which has been allocated and freed before, the next allocating goes from upper to lower addresses. This will IMHO be bad for realloc calls, because the memory behind will most likely be used, resulting in gaps if the memory size decreases and memory copies if increased.

3. There have been cases found where malloc claims not to have any memory free, which is wrong.

All three issues can be created with the attached sample.

Malte <malte>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #18562:  tests.zip added by malte (17KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by arcanum (Posted a comment)
  • -unavailable- added by sternst (Posted a comment)
  • -unavailable- added by malte (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 07 Jun 2010 06:11:13 PM UTCjoerg_wunschStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Fri 04 Jun 2010 02:42:50 PM UTCjoerg_wunschStatusNone=>In Progress
      Percent Complete0%=>30%
    Wed 26 Aug 2009 08:58:02 PM UTCarcanumAssigned toNone=>joerg_wunsch
    Wed 12 Aug 2009 02:54:00 PM UTCmalteAttached File-=>Added tests.zip, #18562

    Back to the top


    Powered by Savane 3.1-cleanup1