07-26-2006 09:35 PM
07-26-2006 09:53 PM
Well, any computer should be able to handle an 4M array of I32 (~16MB).
Look at your buffer allocations to see how many copies of the array are in memory. Do some profiling. What is the memory usage of the VI during run? Remember that e.g. local variables create data copies.
Some more questions:
Easiest would be if you could attach your code. Maybe we can point out some obvious bottlenecks. 😄
07-26-2006 10:50 PM
07-26-2006 11:06 PM
07-27-2006 02:44 AM
07-27-2006 06:54 AM
07-27-2006 08:47 AM
Hi Hugo,
Thanks for the great comments for GerdW!
The gold bars under Gerd's name indicates "non-NI".
If you have time, you can review this list of Gred's answers and and award stars for some other answer that may have gone over-looked.
http://forums.ni.com/ni/tracker?user.id=16916
Ben
Go Gold Team!
07-27-2006 10:53 AM - edited 07-27-2006 10:53 AM
Message Edited by altenbach on 07-27-2006 08:54 AM
07-28-2006 12:50 AM - edited 07-28-2006 12:50 AM
Message Edited by Nick C on 07-28-2006 12:36 PM
07-28-2006 11:10 AM
@hugoliang wrote:
And to use the "build array" not use the "replace array".When the array is chosen to 4M. The computer also makes a mistake.Which is the better way? build array or replace array.
"Replace array subset" is ALWAYS better. When you use built array in a loop, you are changing the size of the array with each loop iteration, causing expensive memory reallocation operations. In contrast, this needs to be done only once If you initialize a full-size array at the beginning of the loop. For large arrays and large N, the performance difference will be enourmous. Trust me.
The computer does not make mistakes, there must be a mistake in your code. Can you explain in more detail what kind of "mistake" you're seeing?
@hugoliang wrote:
I don't know the mount of data with each shot. so for example, I decide to get 1k data, and I have initialized an 1k array, when I have gotten 999 data. next the length of array is not 1, such as 5,can the "replace array" work properly? Make the length of array to 1004?Thank you!
Well, you need to initialize the array to a reasonable upper limit, for example size 1010 in the above example. After the loop, you know exacly how much data you have and you can trim the array to the exact size. This is still much more efficient.