Not Enough Memory - Global and Local Variables

Can anybody give any advice on the Dynamic Memory usage in XOD? I’ve been looking around but can’t find anything… I’m getting this error about memory

Begin compiling code for the board Arduino Mega or Mega 2560 📦


Sketch uses 180414 bytes (71%) of program storage space. Maximum is 253952 bytes.
Global variables use 8529 bytes (104%) of dynamic memory, leaving -337 bytes for local variables. Maximum is 8192 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.

Error during build: data section exceeds available space in board
Compilation failed
Command Process exited with code 1
The generated C++ code contains errors. It can be due to a bad node implementation or if your board is not compatible with XOD runtime code. The original compiler error message is above. Fix C++ errors to continue. If you believe it is a bug, report the problem to XOD developers.

I’ve only got one watch node on the project, currently. I’ve also minimized by programming out variadic nodes, to constant “arity”.

I didn’t see any way to verify the usage of the memory without throwing an error. Is there a way to see the memory usage of this Dynamic Memory?

Is it the use of BUSES? Are all the pins on the nodes contributing to this memory? What if I wire constants to the pins instead of just typing in a default value? What eats up all the memory, generally?

hello, can you upload a screenshot of the patch?

Well, I’m trying to “encapsulate” functionality, so my “main” patch looks somewhat clean. I’m trying to implement a menu functionality that I posted about a while back. I was trying to make methods to change values, like a decimal and even the date. The date seems to be giving the most problem. The patch takes a datetime, and allows the user to update the date or time, then save the value, and export it out of the node to be processed in the main node. I use Bus Nodes to transport a pulse and the new datetime.

I am running 4 devices on the i2c, 1 spi sd card reader, and uart, and some digital lines.

I noticed that XOD appears to load nodes in the project even when they aren’t used in the main or sub-nodes. Definitely, deleting watch nodes helps reduce memory usage. Apparently, anything “strings” takes up lots of memory; although I’ve tried to minimize the array size to hold what I need.

It’s not clear how XOD uses “subroutines” and pass data to the pins on nodes. It is by Reference, or by Value? Based on the way that strings are handled, those are passed as a C++ pointer, but I’m not sure??

Here’s a patch that seams to be taking a lot of memory. It just parses the date time, and then transforms the selected portion into a number and allows the user to change it. They can hold 2 buttons to cancel, or press 1 to save. I was considering trying to either try to code this in the C++ side, or maybe try to reduce my menu memory (not shown) by reading each menu set from sdcard. An advanced sdcard library could be awesome! that helps augment XOD functionality. Though, there’s no sdcard library wrap that allows reading. Presently, I’m abandoning the advanced menu functionality, and going to focus on the other aspects. It would be good to understand how XOD handles the memory a little better. Like how the scope translate into Global or Local, and where and how it affects the memory usage… For example, is the whole library loaded, when only a couple of functions are used? In that case, we would want to allow XOD to only load the portions of the library that are used, for example. Also, how XOD uses subroutines, and how it chooses Local or Global Variables?

The node “DateOrTime” is just and If-then node… The DT BUS is a Boolean that come in from SEL pin that says to edit Date (T) or Time (F).

XOD generally does not use global variables, because any of the nodes can be included multiple times, which would cause unexpected results with shared variables between them. If you want a value shared between nodes, you need to pass it to each of the nodes using it (or rewrite the code so only a single node needs that value, but that will not always be possible). You can also code a pass-through pin to put the same value on an output pin as an input pin has. There are many examples of this for nodes that use MUX and DEV.