Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic memory allocation errors and heap size (Read 954 times)
sean.journot
Newbies
*
Offline


Posts: 1
Joined: Feb 22nd, 2017
memory allocation errors and heap size
Feb 22nd, 2017 at 7:02am
Print Post  
This is just a heads up for anyone else who runs into this problem in the future. 

Programing a Fubarino SD <512k flash, 128K ram>:

So I was trying to read a variable sized data structure into memory from a text file and I found that if I attempted to allocate more than about 2K bytes the allocation would hang up and the program would freeze. Instead of allocating memory in 1 large block I tried implementing my data structure as a link list; this would also fail after about 2K bytes were allocated program wide. Since my program was fairly small, at least in the context of listed chip memory, I figured that there must have been some sort of compiler command that limited the size of the available heap. After some research I found that MPLAB x has an option for adjusting heap size, and I reasoned that visual micro must also incorporate that same feature somewhere. I found this file:
chipKIT-application-32MX795F512.ld
and modified the value of _MIN_HEAP_SIZE to 0x8000(32k bytes) from a value of 0x800 (which just happens to be 2048 bytes)
works great now  Cheesy
So if you are having issues using new or malloc() or whatever and know that you should have a large amount of memory available find the .ld file for your chip inside of your arduino packages file and edit it appropriately.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint