How do I view how much memory I have available when debugging the Netduino Plus 2 ? I added Debug.EnableGCMessages(true) thinking this would show me the memory situation in the output window. Do I need to use Debug.GC(true) as well ? If so, what is the recommended practice as far as where to place the Debug.GC. Do I place it before a potential problem routine starts or should it be the first line of the routine ?
4 replies to this topic
#1
Posted 09 March 2015 - 06:16 PM
#2
Posted 09 March 2015 - 06:52 PM
true forces the GC to run and release memory.
You want Debug.Print(Debug.GC(false).ToSting());
- bgreer5050 likes this
#3
Posted 10 March 2015 - 03:55 PM
For the Netduino Plus 2, at what value should I start worrying that my code is inefficient ?
#4
Posted 10 March 2015 - 07:27 PM
Hi bgreer5050,
What kind of metric/test are you looking for, regarding efficiency? Generally speaking, using extra RAM doesn't hurt your project--unless you need it for something else. It's going to be filled with "empty data" and consume power if you don't use the RAM.
BTW, if you're building something which needs to run for very long periods of time and handles lots of data, we generally recommend pre-allocating RAM using class-scoped variables. That way memory is only allocated from the remaining heap--and the GC is only activated--for things which need temporary memory allocation.
Chris
What kind of metric/test are you looking for, regarding efficiency? Generally speaking, using extra RAM doesn't hurt your project--unless you need it for something else. It's going to be filled with "empty data" and consume power if you don't use the RAM.
BTW, if you're building something which needs to run for very long periods of time and handles lots of data, we generally recommend pre-allocating RAM using class-scoped variables. That way memory is only allocated from the remaining heap--and the GC is only activated--for things which need temporary memory allocation.
Chris
- bgreer5050 likes this
#5
Posted 15 March 2015 - 03:10 PM
Thanks Chris. I will take your advice into account and pre-allocate.
Also tagged with one or more of these keywords: Memory
Hardware →
Netduino Plus 2 (and Netduino Plus 1) →
SD Memory issue when writingStarted by cSharper, 23 Jul 2015 sd, memory, netduino, plus, two |
|
|||
Hardware →
Netduino 3 →
Accessing AT24C32 MemoryStarted by tridy, 13 Jul 2015 AT24C32, memory, 32K, SQW |
|
|||
Hardware →
Netduino Plus 2 (and Netduino Plus 1) →
Slow I/O to MicroSDStarted by HABOT, 28 Apr 2014 MicroSD, Memory, I/O, Class 2 |
|
|||
Answered
Hardware →
Netduino Plus 2 (and Netduino Plus 1) →
Memory error while Deploying 4.2.2.2Started by piwi, 21 Aug 2013 deploy, error, memory, 4.2.2.2 |
|
|||
Answered
Hardware →
Netduino Plus 2 (and Netduino Plus 1) →
HC-SR04 Ultrasonic Sensor Memory ProblemStarted by stotech, 16 Jul 2013 HC-SR04, Ultrasonic, Sensor and 1 more... |
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users