As Boyapati, Anitha wrote: > Do we have an English version of the page referred in the bug > report? http://www.mikrocontroller.net/topic/147150
Nope, after all, it's a (German-language) forum, so it's naturally that people do not translate their entries. I think the most important one (to you) is my entry here: http://www.mikrocontroller.net/topic/147150#1370958 <translation> Stefan Ernst wrote: > The key point though is the malloc following that. The region > freed by realloc should be combined with the subsequent region. OK, if the subsequent region is still free then, this is correct. Without really looking into the code right now, I've got an idea what's happening (yes, a bug report would be useful, even though I currently don't have the time to look after it): the region after all allocations isn't handled as free space, but a piece of that cake will only be taken if the chunks freed so far don't suffice. Now, the realloc() returns only 24 bytes. These form the only freelist entry by that time, and since they don't suffice to satisfy the request for 34 bytes, this entry is ignored, and a new piece of cake is obtained from the heap [*] (so the pointer is incremented which marks the address that has been used as the highest heap address so far). Currently, the top address will only ever be incremented but never be fixed downwards in case the entire block at the end of the heap has been freed up. The cake is a one-way street. ;-) Changing this is certainly possible, but unfortunately quite a bit of work, since by the same time, snippets for the testbench would have to be written as well, for one in order to ensure no new bugs will be created, on the other hand to verify the block is indeed returned (i.e., the latter test would have to FAIL with the current code but to PASS with a fixed version). </translation> [*]The use of the term "heap" here matches the German forum text but is not consistent. Here, it refers to the space above the highest current allocation that has ever been made for malloc(), while in other parts of the text, we use the term to refer to the entire area that is currently in use for malloc allocations (i.e., all active allocations plus the freelist). Later on, I'm using the term "cake" to refer to the free space between the top of all malloc allocations and the bottom of the application's stack, in the sense of a "cake you can take something away from". I'm sorry, but translating texts takes so much time, I'm unable to translate you the entire thread. No idea whether having it translated by Google or Altavista would yield something comprehensible. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev