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

 
 

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

bug #27235: malloc: Several things go wrong

Submitter:  Malte <malte>
Submitted:  Wed 12 Aug 2009 02:54:00 PM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  libc code
Status:  Fixed Assigned to:  joerg_wunsch
Percent Complete:  30% Open/Closed:  Closed
Release:  1.6.6 Fixed Release:  None

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>
Group administrator
Mon 07 Jun 2010 02:46:07 PM UTC, comment #5: 

Sorry, I confused that with bug #25723.

Joerg Wunsch <joerg_wunsch>
Group administrator
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>
Group administrator
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>
Group administrator
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>
Group 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.)

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
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by sternst (Posted a comment)
  • -email is unavailable- added by malte (Submitted the item)
  •  

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-06-07 joerg_wunsch StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2010-06-04 joerg_wunsch StatusNone In Progress
        Percent Complete0% 30%
    2009-08-26 arcanum Assigned toNone joerg_wunsch
    2009-08-12 malte Attached File- Added tests.zip, #18562

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code