Hi everybody. I'm developing a proyect with an atmega128 and I've got some troubles with dinamic memory allocation.
I have a structure with an uint8_t pointer and tree uint16_t variables inside. Initially I create a pointer for this structure and initialize it with a call to malloc. Later I initialize the uint8_t pointer inside the structure with another call to malloc. In this case, I initialize with a lenght of 150 bytes. Later, I made a lot of calls to a funcion (that is not a recursive function). In this function I call malloc at the init to initialice a uint8_t buffer. Later, when the function is end, I free this space. My program runs ok for a time, later it crashes. I've debugged it with avarice and ddd and I've noticed the function before commented runs ok for 5 or 6 times, later, when I call the malloc function this call to malloc never returns. Debugging the code, I've seen the program never end the step two of the malloc function. At the end of the code before any call to malloc, I initialize __malloc_heap_start to 0x808000 and __malloc_heap_end to 0x80ffff. Of course the external memory is activated in the early init as described in avr-libc user manual and it works fine. Someone knows what's the reason for this malfunction in my application? It's some bug on avr-libc or is an error by me? thanks. -- Nunca confies en un S.O. del que no tienes código fuente ;-) -------------------------------- Javier Almansa Sobrino. Ingeniero Técnico en Informática de Sistemas. Grupo de Investigación ARCo. Escuela Superior de Informática. Ciudad Real Tel: (+34)926 29 53 00 Ext: 3705 _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
