is there any memory leak in dtoa?

Asked by liang

we are using the gcc4.8.4 on the cortex-m4 platform, we got the toolchain from the path https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q3-update and use the newlib-nano as the c-stand-library.

we found that there maybe some memory leak in dtoa() and Balloc()
the sample code like this, the g_heap_end is the current heap location, we extern the location from the sbrk():

extern char *g_heap_end;
while(1) {
     printf( "the current heap address is :0x%x\r\n", (uint32_t)g_heap_end);
    const float test_value = 12345.6789;
    int i = 0;

    for(i=0;i<100;i++) {
        printf("the float value is: %lf\r\n", test_value);
    }
}

the test result like this :
the current heap address is 0x4002aa4
the current heap address is 0x4002ac4 //the heap current location rise 0xc4-0xa4=32byte
the current heap address is 0x4002ac4
the current heap address is 0x4002ac4
the current heap address is 0x4002ac4
the current heap address is 0x4002ac4
the current heap address is 0x4002ac4
the current heap address is 0x4002ac4
the current heap address is 0x4002bcc //the heap current location rise 0xbcc-0xac4 = 264byte
the current heap address is 0x4002bcc
the current heap address is 0x4002bcc
the current heap address is 0x4002bcc
.... //none any change again

our question is that, is there any memory leak in the printf_float, which will call dota?
how to fix this issue? could your give me some suggestion?

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.