LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crash and massive memory use when reshaping array

Solved!
Go to solution

Hello everyone, for a school assignment I had to make a VI that would accumulate prime numbers using a previously made prime number finder, and then save them in a 10x10 array, for that to eventually be exported to excel (however that is not the issue here).

 

I really struggle with arrays in LabVIEW, so I decided to save all my numbers in a 1x100 array and then to use the 'Reshape Array' function to shape it into a 10x10 array. However, whenever the VI reaches this step it uses all my memory and eventually crashes. 

 

Does anyone know a workaround or does anyone have a more elegant solution for my issue? I have attached my VI below.

 

Aniessen_0-1695492168025.png

Left on the image is the 1x100 array and to the right is the 'Reshape Array' function attached to a 10x10 array.

 

 

0 Kudos
Message 1 of 4
(770 Views)
Solution
Accepted by topic author Aniessen

You are creating a 11 dimensional array!

0 Kudos
Message 2 of 4
(756 Views)

Whoops, cheers!

0 Kudos
Message 3 of 4
(750 Views)

Sorry, it was looking at it on the phone screen earlier, you were actually only creating a 10 dimensional array. a 10x10x10x10x10x10x10x10x10x10 I64 array is about 80GB 😄

("Reshape array" pads (or truncates) to the final size, so that's what it was trying to allocate! 😄 )

 

Here's all you really need:

 

altenbach_0-1695496261203.png

 

 

Your array indicator seems to have the wrong representation.  Do you really need I64 integers? Maybe there are some other unreasonable code decisions. Feel free to share the rest of your code...

Message 4 of 4
(715 Views)