LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

catch "memory is full" error

Hello all,

 

 

 Is there any way to catch "memory is full" error while working with array vi's?

So that program will try to terminate softly at least.

 

 

Regards,

Michael

_________________________________________________________________________________________________
LV 8.2 at Windows & Linux


0 Kudos
Message 1 of 6
(3,665 Views)

The best way is to prevent the situation from occuring in the first place, which requires planning. One might think about simply checking to see how much memory is available, but that would not be enough since for an array you need a contiguous amount of memory, not just "enough" memory. If your program tries to allocate memory that isn't available you get a hard crash. Nothing you can do about it.

 

Perhaps you can provide more information as to what you're doing so we can provide suggestions on how to trim down your memory needs. Are you using a lot of Build Array functions? Are you using a lot of local variables? Do you have a lot of coercion? Are you using larger datatypes than you need (e.g., DBL when you can get away with SGL)?

0 Kudos
Message 2 of 6
(3,647 Views)

Hi smercurio,

 

 In general this is a data from MRI machine.Till now it was 128x128x128  array, double,complex.Now it grows to 1024x1024x128.No way

to handle it in memory in 32 bit machine.And 64 is still in infancy (drivers for hardware etc.).

  So up today I managed with regular 3d array,just using carefully.Now I started to write  a "class" that can manage such an amount of data.

Was thinking about two cases: 

  1) For relative small images to use array of single element queue that contains 2D array. So we don't need continious block.

 

  2) For large images, write each slice to disk - getting 128 files, use VI server for this, to make it network transparent -> add helper PC in the future.

 

I think when finish I would post it here or at Lava,after all it a nice example of using LV.

 

About catching memory error - if it possible, it provides the way programmatically switch from case 1) to case 2)

 

 

_________________________________________________________________________________________________
LV 8.2 at Windows & Linux


0 Kudos
Message 3 of 6
(3,642 Views)

It does not appear I can help you much, but I am going to try, anyway.

 

If you have not already done so, you should consider reading Managing Large Data Sets in LabVIEW. It does not mention the InPlace node, but otherwise is fairly complete.  From your comments above, it appears you already know most of this, though.

 

Consider using HDF5 for your data storage needs.  It has both in-memory and on-disk data models, making it fairly seamless to transition from one to another.  The down side is that the in-memory data is significantly slower than native LabVIEW arrays. You can get an old HDF5 API here.  Contact Tomi Maila at Expressionflow for something a bit more up-to-date.

Message 4 of 6
(3,615 Views)
Thanks DFGray , I will check it
_________________________________________________________________________________________________
LV 8.2 at Windows & Linux


0 Kudos
Message 5 of 6
(3,585 Views)

The only thing that comes close is a VI I found down in one of the legacyt VI's for DSC.

 

 

...\vi.lib\lvdsc\common\platform\win32\WINMEM_Get Avail Virtual Memory.vi

 

will tell you the status of your memory. If you know ahead of time effect your action will have on memory, you can use that function to decide if it safe to try.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 6
(3,575 Views)