LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

String Parser RT Memory Allocation

HI
I use labview 7.1 for my application
I follow the structure with 3 softs parts
1) A client application  (build by another service) send me STRING commands to my PXI Rack with TCP functions
2) On my PXI target a Low priority Vi Parse the received command and send to the critical loop by RT FIFO (float)
3) Then in the critical loop i decode with cast and enum type def strict  my command ( it 's more handy for me )
    and do action reclaimed by client application

The problem: An out Of memory error appeared after 1 or 2 weeks
I have some problem to be sure, but after investigation
I notice in my parser  in loop critical loop severals string concatenation
And it was non recommended
So i will allocate a U8 array at a specified length but for the parser I  need to use
 match pattern function, trim whitespace, scan string for tokens ....
Are they safe for memory Allocation .
How to be sure that an output of these function (for instance  token string)  will not cause a another memory allocation 
How to fix the max lenght string (the memmory allocation) for these kind of out put

0 Kudos
Message 1 of 6
(3,163 Views)
I don't know if this is possible with your application, but if use a .NET (did they even have that in 7.1?) then you can set the maxLength peoprty of the .NET textBox. I don't see a way to do that with a LV String...
________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 2 of 6
(3,146 Views)
If your application use Real time OS, you can use the Real time system manager to see the memory used by the application : 
 
 
Under windows you can use th profile tools to see wich memory are used by the differents VI. (https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/dialog-boxes/profile-performance-and-memor...)
 
Regards,

Christophe S.
Account Manager East of France І Certified LabVIEW Associate Developer І National Instruments France

0 Kudos
Message 3 of 6
(3,129 Views)
thanks to All for answer but
I have tried Real time system Manager, and how can we  find in which VI  there is bad memory allocation



0 Kudos
Message 4 of 6
(3,123 Views)

I can't off-hand tell you which string operations work in-place and which do not.

I can confirm that sting operations (or any operation that invloves buffers that can grow) are dangerous for RT apps that must run for an extended period of time.

I sugest you run your app under Windows and use the built-in Profiler tools to figure out which VI's are demanding more memory.

Another tool is the "Trace Execution Toolkit" which will illustrate when the memory manger is being invoked.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(3,118 Views)
Thanks you ben
But could you tell me if "match pattern" or "scan string for tokens" are  dangerous for RT apps
If yes, by what we can replace these functions on RT (normal priority loop)

I precise i use them not in ctritical section loop but just in normal priority loop which ensure dialog with extern server  and higest priority loop
I am a little bit devastated by this.
I have take care in critical loop to preallocate my variable  and Array I didn't use string in it
but I am surprised by a memory leak with normal loop priority

Should i code by myself "macth pattern" or "scan string for tokens" with array function  to ensure good allocation






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