I have an application that I want to leave running for days, logging data into internal arrays. When I bring my laptop back to the hardware and reconnect serial cable, apparently the serial connection causes the whole application to reboot, rerunning setup and re-initializing all the arrays. How can I reconnect serial for a data dump without restarting the whole sketch?
Resistor, capacitor, or knife... https://www.google.com/search?q=arduino+disable+auto+reset
You will get a more precise answer by revealing which board you are using.
On a Nano I use a 100nF ceramic cap and a small SPDT slide switch, like this: Switching the cap to the reset pin will keep the Nano from resetting when serial comm is connected.
An option I would prefer is to use a USB-TTL cable to connect to pins Tx and Rx and GND for the purpose of collecting the data. That arrangement has no possibility for resetting the Arduino.