NodeRED crashing due to "Javascript out of heap memory" issue

Is that true if the wire goes to a disabled node?
What about a debug node whose output is "turned off"?

Does this Node-red instance interact directly with database and Modbus clients?
It might be worth moving data acquisition to a separate NR instance on another machine and use MQTT to forward it to be processed.

What hardware are you running on?

Have you experimented with the same Node-red flows but not under Docker? (I have no reason at all to think Docker might be at fault, it's just one more factor to consider).

[This thread](This thread [Question about context and RAM - #2 by Paul-Reed]) discusses some ways to monitor Node-red memory usage.