LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to allocate memory dynamically?

Hello,

I'm dealing with an array of fourteen (1024x8192 pix) images.
Everything works correctly when the images are smaller,
but when I use 1024x8192 ones for the calculations
I run out of memory after 7th image.

So is there a way for me to dynamically allocate memory size?
So that IMAQ,arrays etc. do not keep allocating new space for
data everytime.

Labview memory raises up to 1 300 000K
based on Windows Task Manager and crashes.
I have 2GB memory on this machine.

Best Regards,
Ari

0 Kudos
Message 1 of 5
(3,679 Views)

Generate the IMAQ images in the begining of the program and reuse them as much as possible.  do you ever need all 14 images at a time?  if not figure out the maximum number of Images needed and create this (buffer) space in the begining then destroy them at the end of the application.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(3,677 Views)
Thanks,

I already moved them out of the for loop, which has 14 iterations, but it did not help.

"1074396159 occurred at IMAQ ComplexConjugate"
This error message always pops up. (or one of the other IMAQ functions)

Any idea if large arrays such as 10x10 multipled can take so much memory?
Or do you think the problem is rather in the IMAQ functions (FFT, Concolute, ComplexPlaneToImage, etc.),
which are ran 10-20 times each before the crash.

 Br, Ari
0 Kudos
Message 3 of 5
(3,657 Views)
Try profiling the code this will tell you where memory and CPU resoureces are being used then you can optomize for the results.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 5
(3,646 Views)
No matter how much memory you have on the machine, you will never be able to use more than 1.5GBytes on a WindowsXP machine.  If you got 1.3GBytes, you did well, since the LV code must fit into that 1.5GBytes, as well.  The reason is that Windows is a 32 bit operating system and LabVIEW is a 32 bit executable.  It has an absolute maximum limit of 4GBytes.  Windows reserves the negative numbers for system code.  It also reserves the top 512MBytes of the positive 2GBytes for system DLLs.  That leaves everything else with 1.5GBytes.  Depending on your memory fragmentation and what other code is running, you will be able to use somewhat less than this.  So you probably need to rewrite to only load what you are actually using.

For tips on dealing with large memory issues, check out Managing Large Data Sets in LabVIEW.

Good luck.  Let us know if we can help more.
0 Kudos
Message 5 of 5
(3,634 Views)