Jump to content

Memory Leaks


EJW

Recommended Posts

I am updating a labview 7.1 program. I removed all traditional nidaq code and replaced with daqmx code and the daq assistants.

The program, when compiled (myprogram.exe), has a memory leak. The memory useage continues to grow until you get low on virtual memory.

However, in the dev mode inside of labview, there does not appear to be a memory leak. The labview memory useage never changes.

How would i go about finding what is causing this? there are about 4 daq assistants in a while loop waiting on a test to start. these DA's poll various digital and analog channels. Could these be the cause of the leak. If so, why only in compiled version and not the ide.

Link to comment

QUOTE (EJW @ Aug 1 2008, 03:35 PM)

there are about 4 daq assistants in a while loop waiting on a test to start. these DA's poll various digital and analog channels. Could these be the cause of the leak. If so, why only in compiled version and not the ide.

You mean like express VIs?

I would go for proper DAQ routines. An express VI might load a new task on every iteration, and in compiled mode some optimizations might be left out.

Ton

Link to comment

QUOTE (Ton @ Aug 1 2008, 10:06 AM)

You mean like express VIs?

I would go for proper DAQ routines. An express VI might load a new task on every iteration, and in compiled mode some optimizations might be left out.

Ton

I thought of that , so i added a clear task on the task out of each express vi, which actually caused it to fail on the second iteration.

I was actuall trying to minimize the amount of code i was rewriting in this program as there is a new version in 8.5 coming in about 2 months,

and i didn't want to spend a lot of time on this one!

Link to comment

QUOTE (EJW @ Aug 1 2008, 09:35 AM)

I am updating a labview 7.1 program. I removed all traditional nidaq code and replaced with daqmx code and the daq assistants.

The program, when compiled (myprogram.exe), has a memory leak. The memory useage continues to grow until you get low on virtual memory.

However, in the dev mode inside of labview, there does not appear to be a memory leak. The labview memory useage never changes.

How would i go about finding what is causing this? there are about 4 daq assistants in a while loop waiting on a test to start. these DA's poll various digital and analog channels. Could these be the cause of the leak. If so, why only in compiled version and not the ide.

Hi EJW:

Not sure why you're having this problem, and why only in executable not in Development system, but I'd worry about the DAQ Assistants creating handles to Daq processes, and not--for one reason or another--destroying them when done.

You might want to try opening these up, and breaking them apart into three pieces-- Initialization part to move outside and before your while loop, part that needs to be done every loop cycle inside the loop, and part that closes the processes outside the loop and after. Might not be as easy as I'm making it sound, but if you can do it easily, might be worth a try.

Best Luck, Louis

Link to comment

QUOTE (Louis Manfredi @ Aug 1 2008, 10:14 AM)

Hi EJW:

Not sure why you're having this problem, and why only in executable not in Development system, but I'd worry about the DAQ Assistants creating handles to Daq processes, and not--for one reason or another--destroying them when done.

You might want to try opening these up, and breaking them apart into three pieces-- Initialization part to move outside and before your while loop, part that needs to be done every loop cycle inside the loop, and part that closes the processes outside the loop and after. Might not be as easy as I'm making it sound, but if you can do it easily, might be worth a try.

Best Luck, Louis

Yeah, that is what i am doing now, i know i have run into issues where one task reads DIO and another writes to DIO on the same device (different lines).

Also, the other device reads a DIO and an AI, but i dont think that is usually a problem.

Worst case, I'll string em all together with the errors and let them operate sequentially.

In some cases i know i have had to actuall insert a stop task otherwise the next task doesnt work. I am hoping to complete this without all the extras!

EDIT:: I converted the assistants to code only, put them outside the while loop and did the read/write in the loop and the memory leak went away. Now i just

have to make sure everything is functioning on the machine it goes on. Hopefully there are no issues.

Link to comment

QUOTE (Ton @ Aug 1 2008, 10:06 AM)

You mean like express VIs?

I would go for proper DAQ routines. An express VI might load a new task on every iteration, and in compiled mode some optimizations might be left out.

Ton

I found something interesting. The machine I wrote the code on uses daqmx 7.4.0f0, my test machine in the lab uses 8.0.1f0 - the problem shows on both machines.

However, i checked the machine that is actually running the test, which uses 8.0.0f0, and it is not happening on it.

That is very strange.

:headbang:

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.