- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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); }Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page