[3.5b1+]OoM after a while when using lots of local array vars
-
@Diamondback which board is this running on?
You can use M122 to track the memory usage of the garbage-collected heap, which is where arrays are stored.
-
@OwenD said in [3.5b1+]OoM after a while when using lots of local array vars:
I can't speak for how long the variables stay in memory, however your macro and method of calling it is very inefficient in terms of memory usage.
You're creating (the same) arrays in both macros and duplicating the individual array elements in the second macro.Yep I know, this is on purpose as I want to see how RRF deals with this and how careful I need to be when using custom arrays.
-
@dc42 Duet 3 6HC
-
@OwenD said in [3.5b1+]OoM after a while when using lots of local array vars:
This looks very odd??
What do you mean? This line just sets the desired brightness of a pixel based on whether or not it's supposed to be on.
-
@Diamondback said in [3.5b1+]OoM after a while when using lots of local array vars:
@OwenD said in [3.5b1+]OoM after a while when using lots of local array vars:
This looks very odd??
What do you mean? This line just sets the desired brightness of a pixel based on whether or not it's supposed to be on.
Gotcha.
I wasn't seeing how it resolved to an integer.
Had to go look at the syntax.
I learned something -
@dc42 said in [3.5b1+]OoM after a while when using lots of local array vars:
You can use M122 to track the memory usage of the garbage-collected heap, which is where arrays are stored.
What exactly shall I look at? When running M122 from time to time (with the memory guzzling code active) I can see the "never used RAM" go down in fairly large chunks once in a while until it resets.
-
@Diamondback I will try to reproduce it.
-
@Diamondback some of the memory allocated for storing the nested arrays is not being reclaimed. I will investigate.
The line from the M122 report that I was referring to is this one:
Heap OK, handles allocated/used 495/450, heap memory allocated/used/recyclable 30720/28968/168, gc cycles 23
-
@Diamondback please try the binary at https://www.dropbox.com/sh/6s1sbescl9di7d2/AAAaiB9VF-XT_VpIRYL8Lq-0a?dl=0.
-
@dc42 This seems to fix it the memory leak Now it only resets after a while due to the issue mentioned here (same behavior as without using the local arrays all the time)
https://forum.duet3d.com/topic/31168/3-5b1-reset-reason-stuckinspinloop -