Flowfuse Device Agent crashes. FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

No, the device agent installs the node-red version specified in the device settings or whatever value (if any) is in your target snapshot. So for example, you can override this in device settings -> node-red -> version.

Actually, that is a valid point. In the launcher file, we do add --max_old_space_size=512. What that means is when this heap fills up, Node.js needs to perform a garbage collection (GC) cycle. Coupled with your comment about "now not able to modify flows" (my mind reads "you have recently modified flows") from that, I dont think it is a stretch to conclude something has changed and the GC is now unable able to keep up with memory allocations.

Are you able to try something out? If possible, edit the file lib/launcher.js in your device agent installation and change the line to something like '--max_old_space_size=1024' (or remove it altogether)