From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Large Array "In Place Struct" or "replace element"

Solved!
Go to solution

Hi community

 

I have a fundamental question regarding performance and memory allocation. 

In the past we sometimeise dealed with a "memory full error" massage and a corresponding labview crash.

These are happening usually on relativley long running applications with a fast aquisition rate.

Typical data rate is about 100000 SGL numbers per down to 50ms.

 

As it seemed that the reallocation of array elements may be the reason for the chrashes we are now intensively using IN PLACE structures to manipulate pre initialized array.

 

Here comes my question.

Is there a general rule when it is better to replace an array subset by the LV replace subset function or is it better to make some big loops as hown in my code for the replacements.

Personally I worry about these loops (or is ist just OK) and the compiler is clever enough to optimize these things.

 

Please state on both topics ---> CPU usage

                                                 ---> Memory management problems

 

 

Thank you in advance

 

Cheers

 

Gernot

 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 1 of 3
(2,635 Views)
Solution
Accepted by topic author nottilie

Just use Replace Array Subset.  It is a single function that does what you want.  And it does it in place (no memory reallocations).  It is also likely (can't say for certain) that it will perform faster than the In Place Element Structure inside of a FOR loop.


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 2 of 3
(2,613 Views)

Thank you for the clarification

 

Gernot

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 3 of 3
(2,554 Views)