URL: <http://savannah.nongnu.org/bugs/?27235>
Summary: malloc: Several things go wrong Project: AVR C Runtime Library Submitted by: malte Submitted on: Wed 12 Aug 2009 02:54:00 PM GMT Category: Library Severity: 3 - Normal Priority: 5 - Normal Item Group: libc code Status: None Percent Complete: 0% Assigned to: None Open/Closed: Open Discussion Lock: Any Release: 1.6.6 Fixed Release: None _______________________________________________________ Details: 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. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Wed 12 Aug 2009 02:54:00 PM GMT Name: tests.zip Size: 17kB By: malte <http://savannah.nongnu.org/bugs/download.php?file_id=18562> _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?27235> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev