LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory allocation

Hello,

I'm building an application with many sub VI's. This application is reading data from DAQ. When user hits Start button sub vi starts and, using software triggering, waits for valid peak. After peak is detected reads some more data (how much is user dependent- user configures before). If peak is not detected reads constantly data and stores it in a queue using lossy enqueue element.

Any time I hit Start the memory usage increases about 25MB.

Every time user hits Start, one sub vi obtains Queues (2, one for history data, before peak  and one for data after peak is detected), these queues are passed to another vi that builds one array of data from both queues and destroys queues.

 

How to find where this memory disappears?

I added Execution Trace that contains events from 3 hits of start button.

 

Thank you,

Przemek

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

This is impossible to tell by looking a picture.

 

  • what are the queue sizes?
  • how big are the 2D arrays?
  • is this the diagram of the subVI? How does the main VI look like?
  • How does the other VI built everything into array data? Can you show that code too? (Are the shift registers initialized? How big do these array get?)
0 Kudos
Message 2 of 5
(3,233 Views)

The main vi looks like that:main.jpg

the sizes of the queues are variable. I tested when max queue size set to 10 (10 2D arrays 40k samples DBL in every array).  The vi that obtains queue:

 

queue.jpg

 

The 2D arrays contains all the elements from both queues, so if queue contains 10 elements each 40kS the array is 4 rows x 400 k:

 

process queue data.jpg

 

I hope it will help.

 

Thank you for reply.

 

Przemek

0 Kudos
Message 3 of 5
(3,205 Views)

Are you looking for where LabVIEW allocates the memory, or deallocates it?

 

LabVIEW is a little funky with deallocating memory.  Once the memory is no longer needed by the program LabVIEW will deallocate it . . .  whenever LabVIEW finds it convenient.  That's why DVR's were created, to be able to create explicit lifetimes for data.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 5
(3,202 Views)

Hello Przemek.

 

I suggest you to use some additional tools that will show you what is happening with memory of your VI.

 

Firstly, you can read about vi memory usage here: https://www.ni.com/docs/en-US/bundle/labview/page/vi-memory-usage.html .

 

To see where on your block diagram LV allocates memory use Show Buffer Allocations Window (you can read about this tool here https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/project/showinplace.html).

 

Also try to use Profile Performance and memory Window (https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/dialog-boxes/profile-performance-and-memor...

 

Use those tools as starting point and try to figure out what part of code is causing to have behavior you are interested in.It is a little bit hard to debug application from print screens. Also, I think that you should a little bit better describe what are sub-vis in your main vi (e.g. what rest of block diagram prints screens exactly present).It would be better to have vis, but as you mention your application is quite a big and that is probably why you did not post vis. If you can extract part of your application that replicate behavior you are interested in, it can be usefull for us who are trying to assist you. Did you try to use those tools that I mention?

 

Best regards, 

S.P.

Message 5 of 5
(3,139 Views)