LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak in NIDAQmx 2026 Q2

I've run into a memory leak in NI-DAQmx and wanted to report it in case it's useful.

Setup
- NI-DAQmx version: 26.3.1
- OS: Windows 11 (64-bit)
- Hardware: reproduces on several multifunction USB devices (e.g. USB-6008, USB-6000, USB-6421, USB-6423)

What I'm doing
I'm working on a small data-logging project where I continuously acquire analog input, and my app repeatedly starts and stops acquisition over a long session. To narrow it down I reduced it to a minimal
loop:

1. Create a task
2. Add an analog input voltage channel
3. Configure sample clock timing (continuous samples)
4. Register an EveryNSamplesEvent callback (DAQmxRegisterEveryNSamplesEvent, Acquired Into Buffer)
5. Start the task
6. Let it run briefly
7. Stop the task
8. Deregister the callback (register with NULL)
9. Clear the task

Repeating this loop, the process memory grows by a small, fixed amount on every iteration — a steady linear climb, not a one-time bump. Over a long-running session this adds up.

Where it seems to come from
Profiling the allocations, the leaked blocks trace back into the driver during task teardown — specifically the destruction of the every-N-samples event handling (an internal
EveryNSamplesEventSupervisor-type object). The allocation originates inside the driver DLLs (nidmxfu.dll / nipalu.dll) on the path from DAQmxClearTask → event supervisor destructor. It looks like the
teardown allocates a small block (~80 bytes) that's never freed.

Notes
- The growth is perfectly linear with iteration count, which is what made me confident it's a genuine leak rather than caching or noise.
- It only occurs when an EveryNSamplesEvent callback has been registered; loops without the callback don't show it.
- Each leaked block is small, but for an app that starts/stops acquisition continuously it accumulates over time.

Message 1 of 7
(1,205 Views)

I have also seen this issue with an older version of DAQmx. Thanks for the confirmation.

0 Kudos
Message 2 of 7
(1,154 Views)

Can you please rerport this as bug? I tried reporting but the site is broken. Also can you confirm that its also ocurring in 2026 Q2 version

0 Kudos
Message 3 of 7
(1,147 Views)

I will try to report it to some NI Reps that I know. I have not yet installed DAQmx 2026Q2 and I am not sure when I will install. Sorry.

0 Kudos
Message 4 of 7
(1,143 Views)

Hi BhaTTa, +1 kudos for the excellent troubleshooting. Please report it as a bug by following the steps detailed at: Report an NI Software Bug. (hopefully the site works for you this time)

 

If it doesn't, please join the public LabVIEW Discord Server, and copy-paste your original post into the "general-software", "general-hardware", or "daq" channels. A link to this server exists at the top of this excellent LabVIEW Wiki page.

 

This may help towards this being recorded as a bug and later fixed, which will benefit everybody.

 

Petru_Tarabuta_0-1782845667127.png

Message 5 of 7
(977 Views)

Report a bug is still down, here is my understanding of the area of leak

Here's why the destructor of the EveryN-samples supervisor is the suspected leak point, in a few lines:

- When DAQmxStartTask arms the EveryN callback, NI internally allocates a tEveryNSamplesEventSupervisor object (the ~64B + ~80B
heap pair) to watch the running acquisition and fire your callback.
- When you deregister via RegisterEveryNSamplesEvent(..., NULL, NULL) and re-register before the next StartTask, that supervisor
should be torn down in its destructor and its memory freed — but it isn't; a fresh supervisor is allocated on the next StartTask
and the old one is orphaned.
- The orphaned objects are only reclaimed at DAQmxClearTask, which is why the count rises dead-linearly (1×64B + 1×80B per
iteration) on a reused task and drops to zero only when the task is cleared.
- The ablation confirms this: the leak appears only when a StartTask follows a deregister/re-register — i.e., exactly the path
that should be destroying the prior supervisor and constructing a new one — so the destructor's cleanup of that supervisor is the
most likely culprit.

Summary DAQmxRegisterEveryNSamplesEvent leaks a fixed pair of heap blocks (one 64-byte + one 80-byte block) per start/stop iteration when an EveryN callback is deregistered and re-registered across a DAQmxStopTask/DAQmxStartTask boundary on a reused task (i.e., a task that is not cleared between acquisitions). The orphaned blocks are only reclaimed by DAQmxClearTask. - Regression: NOT reproducible on NI-DAQmx 2025 Q3. Reproducible on the latest 2026 Q2 (26.3.x). - Rate: exactly 1×64B + 1×80B block leaked per iteration (dead linear, no plateau). Isolation matrix (all runs: task created + configured once, DAQmxClearTask only at the very end)
0 Kudos
Message 6 of 7
(785 Views)

Hey, can you please tell me what was the issue that you had faced, which version of NIDAQmx was it?

0 Kudos
Message 7 of 7
(679 Views)