avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [Bug #2143] malloc() routines chunk smaller than requeste


From: nobody
Subject: [avr-libc-dev] [Bug #2143] malloc() routines chunk smaller than requested
Date: Mon, 06 Jan 2003 10:18:55 -0500

=================== BUG #2143: FULL BUG SNAPSHOT ===================
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2143&group_id=2140

Submitted by: None                      Project: AVR C Runtime Library          
Submitted on: 2003-Jan-06 10:18
Category:  Library                      Severity:  5 - Major                    
Bug Group:  None                        Resolution:  None                       
Assigned to:  None                      Originator Email:  address@hidden      
Status:  Open                           

Summary:  malloc() routines chunk smaller than requested

Original Submission:  
I believe I've found in bug that exists in the malloc() implementation in the 
snapshots from 17dec2002 and 04nov2002.

Here's (basically) the code I'm running:

        char *ptrs[32];
        __malloc_heap_start = 0x8000;
        __malloc_heap_end = 0xFFFF;
        for (j = 0; j < 32; j++) {
                ptrs[j] = (char *)malloc(1024);
                /* output j and ptrs[j] to serial port */
        }

I would expect the last malloc() to return NULL, since there's not 1024 bytes 
left in the heap.  Instead, I get the following output:

0 = 00008002
1 = 00008404
2 = 00008806
-cut-
29 = 0000f43c
30 = 0000f83e
31 = 0000fc40

The last malloc() returns a chunk of memory that is only 959 bytes before the 
end of the heap!





No Followups Have Been Posted


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2143&group_id=2140




reply via email to

[Prev in Thread] Current Thread [Next in Thread]