LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does CPU usage creep up to 100 percent?

If you run the attached code, and wait about 10 minutes, the CPU usage creeps up from ~20% to 100% and stays there.

What's causing this?

I'm replacing array elements, not inserting them, have a one second delay in the loop, don't have any references being opened and not closed.

help!
0 Kudos
Message 1 of 6
(3,052 Views)
Instead of using a local variable for the sem. reference use a shift register and pass the same reference in and use it each iteration of the loop. I think by using 2 locals with the reference you memory size has been increased considerably. Hope this helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 2 of 6
(3,052 Views)
Sorry, I meant to include that the CPU usage creeps up when the 'Log Data' button is pressed.
The CPU usage goes down when it is not pressed.

This makes me think there's something about the graph signals being split and merged, but I'm not sure.
0 Kudos
Message 3 of 6
(3,052 Views)
Disregard my previous answer... First you are preallocating an array of empty dynamic data types. If you then are replacing each element with a populated dynamic data type the buffer allocated for that element might not be big enough to hold that data so it might be allocating another buffer space anyways. Try to preallocate with a filled dynamic data type. The next thing to keep in mind is the sequence structure. When using that sequence structure you might actually be defeating the use of the same buffer anyway. Due to you not passing the shift register through the second case. it might be allocating a new buffer space for the shift register at the end of the second sequence. Try using a small state machine instead of the sequence structure. Hope t
his helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 4 of 6
(3,052 Views)
Thanks, I'll try these and see what happens...
0 Kudos
Message 5 of 6
(3,052 Views)
Do you have to use dynamic data type? Do you have to use one cluster for the output (it seems you only update two values, one is a big array of clusters)?

There is no need to create a local variable for the reference. Just wire the output from the previous semaphore VI.

BTW, the sensor index eventually passes the array boundary, you might want to check the condition.

Joe
0 Kudos
Message 6 of 6
(3,052 Views)