Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

soft reset nios won't deallocate memory

Altera_Forum
Honored Contributor II
910 Views

The following is a simplified version of my main function. It works fine until I asserted Nios' soft reset input several times. After asserting Nios' reset input several times, there was not enough memory to get allocated.  

I tried to put free() function right before return(1) at the end of main function and it didn't do anything. 

 

Any suggestion? 

 

Thanks. 

------------------------------------------------------------ 

 

int main() 

ITEMS *my_items; 

int command; 

 

if ((my_items = (ITEMS *) malloc(sizeof(ITEMS) * MAX_ITEMS)) == NULL) { 

printf("failed to allocate memory\r\n"); 

exit(-1); 

 

// tight loop to wait user's input to do something with ITEMS 

while (1) 

command = IORD_BLA_AVALON_COMMAND (BLA_0_BASE)); 

 

switch (command) 

case 1: set (my_items); break; 

case 2: save (my_items); break; 

case 3: read (my_items); break; 

default: break; 

return (1); 

}
0 Kudos
0 Replies
Reply