I appreciate the efforts you are willing to put in discovering the cause of the leak here. To really establish where is the leak, i.e. what component causes it, we would need to start by isolating different parts of the system.
So, your current loop includes three (at least) independent libraries, and we need to test one by one. The three libraries mentioned are NI Switch Executive (please specify version), the specific driver(s) that you use (please list those as well), and the DAQmx (veersion?).
To start the discovery, please comment out the DAQ acquisition calls, and instead of using your virtual device, use the sample virtual device that relies on the installed "SampleSwitch" simulated switch module that we will assume at this time has no memory leaks.
Adjust the channel names (so that the sample configuration can recognize those) and rerun your loop.
For this test, you want to keep the nise open session and nise close session VIs in the loop, but please, in your applications, don't do that. Avoid doing unnecessary repetitive work as often as possible.
Once you establish that there is no leak with using NISE alone, include the specific driver (by using your original configuration), retest, and then in the end include the data acquisition portion.
Also, let us know the results of the intermediary steps and the versions/types of switches you use I asked about above.
best regards,
-Serge