LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Apparent Memory Leak

Solved!
Go to solution

@mcduff wrote:

This thread may offer some clues, but I have seen this behavior before with AI tasks. I gave up a bit, and decided to reuse tasks where possible. Is your system 32bit? I found it was worse with 32bit systems. You can try inserting some primitives, like below and see if they help.

 

Snap12.png

 

mcduff


McDonald's,  just pointing out... you can't unreserve a running task.  Abort then unreserve.  You also can't abort a task that is unreserved, it has nothing abortabe.   

 

Neither of those coding errors actually throw a real error! But, they sure confuse the bejeezus out of the DAQmx driver that will try to make sense out of what you just told it to do by.....(you're gonna like this) refusing to release some memory just in case what you tried to do could possibly make sense!  Or more likely, the explicit control task yields to the programmers whims, and assumes you meant to do that and will clean up the mess you left yourself. 

 

See my earlier post about rare instances, memory leaks, the DAQmx state transition diagram,  documentation and how to make it all behave nice.


"Should be" isn't "Is" -Jay
Message 11 of 35
(1,924 Views)

Good Catch @JeffB

 

 

0 Kudos
Message 12 of 35
(1,911 Views)

@JÞB

McDonald's,  just pointing out... you can't unreserve a running task.  Abort then unreserve.  You also can't abort a task that is unreserved, it has nothing abortabe.   

 

Neither of those coding errors actually throw a real error! But, they sure confuse the bejeezus out of the DAQmx driver that will try to make sense out of what you just told it to do by.....(you're gonna like this) refusing to release some memory just in case what you tried to do could possibly make sense!  Or more likely, the explicit control task yields to the programmers whims, and assumes you meant to do that and will clean up the mess you left yourself. 

 

See my earlier post about rare instances, memory leaks, the DAQmx state transition diagram,  documentation and how to make it all behave nice.


Looked at the State Diagram, looked at your advice, it all seems logical. Followed your advice, and did an unreserve after an abort, or just a plain abort then stop. LabVIEW froze, had to kill it from Task Manager.

 

Went back to what I posted above, no freeze and it works. Let me shake my 8-ball here, mmm, says stick to what's working even if it makes no f*@&*%() sense! (My 8-ball is pretty crass).

 

Not sure what any of this means, but for now I am using illogical code. NI if you are reading this, check up on this.

 

mcduff

0 Kudos
Message 13 of 35
(1,905 Views)

Which mistake is hanging? Attach the whole vi I have a 6008 round here and tell me the driver version .  My 8-Ball only gets crass when bringing these things up elsewhere;)

 

Still, I bet it's a PEBKAC thing. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 35
(1,893 Views)

@JÞB wrote:

Which mistake is hanging? Attach the whole vi I have a 6008 round here and tell me the driver version .  My 8-Ball only gets crass when bringing these things up elsewhere;)

 

Still, I bet it's a PEBKAC thing. 


Never mind, I just went back to the original post and got all that.... BRB


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 35
(1,878 Views)

Can't post the VI here. Attached are picts that show where it freezes.

Snap15.png

 

Snap16.png

 

 

An abort then stop, freezes in the Stop VI, unreserve, then abort, then stop, no freeze. Undocumented state transitions??

0 Kudos
Message 16 of 35
(1,875 Views)

@JÞB wrote:

@JÞB wrote:

Which mistake is hanging? Attach the whole vi I have a 6008 round here and tell me the driver version .  My 8-Ball only gets crass when bringing these things up elsewhere;)

 

Still, I bet it's a PEBKAC thing. 


Never mind, I just went back to the original post and got all that.... BRB


PEBK&C Confirmed

 

This isn't a DAQmx problem at all

McDuff.pngWhat were you thinking!?

 

Note: The error out is not wired and The default value of "Timeout" is 5

Looking under....

McDuff1.png

We see, after creating the constant

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 17 of 35
(1,872 Views)

@JÞB wrote:

@JÞB wrote:

Which mistake is hanging? Attach the whole vi I have a 6008 round here and tell me the driver version .  My 8-Ball only gets crass when bringing these things up elsewhere;)

 

Still, I bet it's a PEBKAC thing. 


Never mind, I just went back to the original post and got all that.... BRB


PEBK&C Confirmed

 

This isn't a DAQmx problem at all

McDuff.pngWhat were you thinking!?

 

Note: The error out is not wired and The default value of "Timeout" is 5

Looking under....

McDuff1.png

We see, after creating the constant that the default bool read timeout is 2000 (that is Two Thousand) times greater than the event loop will queue up timeout events. No other events are registered and you cannot limit the timeout case to 1 event queued so you are in deadlock 

 

What you have here McDuff is a great big "Shot Yourself in the foot" you wrote.  I cannot imagine why a CAR was filed.  The memory "Leak" here is undoubtedly the event queue filling up with timeout events just like you asked it to do!

 

As an aside, after you stop abusing the Timeout case of an Event Structure, NAME THAT TASK! and DAQmx will look up if a Task of that name exists and use it adjusting properties as you write them.  (the documentation neglected from the state transition diagram is that cleanup is not done until the vi goes idle

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 35
(1,871 Views)

@JÞB wrote:

We see, after creating the constant that the default bool read timeout is 2000 (that is Two Thousand) times greater than the event loop will queue up timeout events. No other events are registered and you cannot limit the timeout case to 1 event queued so you are in deadlock  


I don't think so, Jeff.  The timeout for the Event Structure does not even start timing until the Event Structure is reached again on the next iteration.  Here is the proof:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 19 of 35
(1,861 Views)

@Jeff why would the Boolean read timeout affect how long the VI takes? The Read VI doesn't wait until the end of its Timeout period to do its read, it returns immediately if it's able to, which in this case it will be able to do right away.

 

Also @Jeff, sorry to potentially sidetrack the thread, but in an earlier post you mentioned only creating tasks at development time. While I've seen this is something that "can" be done, none of the examples ever mention it, and I've never seen a reason to do it in practice- I always create tasks with the Create Task VI.

 

What does creating the task do for you at dev time? Got any good examples of that?

0 Kudos
Message 20 of 35
(1,859 Views)