LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

After the VI runs for a period of time, Labview displays an error report window and Windows memory shortage warning

Hi GerdW,

 

I see only one sub-vi is missing in your snapshot, you can refer to the file shown as the picture below first.

rayhsieh_0-1633346560675.png

I will modify my vi files by your command and upload again later.

Thanks~

 

Ray Hsieh

0 Kudos
Message 11 of 18
(408 Views)

Hi GerdW,

 

I have modified my VIs.

Refer to the attachment - Question.zip, please.

Thanks.

 

Ray Hsieh

0 Kudos
Message 12 of 18
(389 Views)

Hi Ray,

 


@rayhsieh wrote:

I have modified my VIs.

Refer to the attachment - Question.zip, please.


No, you did not modify your VI…

Refer to the attachment, please!

 

  • Hide the labels of subVIs/functions. Use the context help window when you don't know them!
  • Cleanup the block diagrams! (Cleanup the frontpanels, too…)
  • Remove Rube-Goldberg constructs…
  • Don't do the same code twice (like reading a file twice just to convert its content differently or calling the very same FileWrite function in each case of a case structure)!
  • Don't set subVIs to reentrant for no good reason!
  • Don't use RequestDeallocation! After all it is "just" a request, but no command…
  • Inside Student_DataSorting there is a comment about breaking the FOR loop after 10 iterations, but the code is set to break after 10000+ iterations!? Something is fishy here…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 18
(373 Views)

Hi GerdW,

 

First of all, really thanks for your correction~

Compared with you and other experts here, I'm a Labview beginner.

As a result, I'm not so clear that how to implement my purpose with smarter methods or experiences. 

 

Here are response to your correction in the last post

 

  • Hide the labels of subVIs/functions. Use the context help window when you don't know them!
    • Ans: Yes, I have already tried this way. However, I have searched lots of on-line information related to the issue but still feel confuse about how to implement to my system. Such as the advice, from  Dobrinov, about not using "build array.vi" and initialize a global array at the beginning of the main vi.  
  • Cleanup the block diagrams! (Cleanup the frontpanels, too…)
    • Ans: I'm not sure about this correction. I have tried to clean up my code by creating sub-vis, less data lines, less indicator and less control in front panel. However, there are some indicator & control must used to transfer data between two sub-vis.
  • Remove Rube-Goldberg constructs…
    • Ans: This correction is a little brief for me. Can you describe this correction in a more clear way? 
  • Don't do the same code twice (like reading a file twice just to convert its content differently or calling the very same FileWrite function in each case of a case structure)!
    • Ans: It's very clear that you have also corrected the code related to this correction.
  • Don't set subVIs to reentrant for no good reason!
    • Ans: Do you mean not using shift register? 
  • Don't use RequestDeallocation! After all it is "just" a request, but no command…
    • Ans: Ok, I will notice this characteristic afterward.
  • Inside Student_DataSorting there is a comment about breaking the FOR loop after 10 iterations, but the code is set to break after 10000+ iterations!? Something is fishy here…
    • Ans: Sorry for this mistake of the comment.

 

Finally, is there any idea about using a global array with enough size instead of build array vi?

 

 

 

 

 

 

0 Kudos
Message 14 of 18
(344 Views)

Hi Dobrinov,

 

Do you have some more concrete indications about your suggestion, such as code corrections?

I have uploaded the latest code, Question.zip, earlier, please refer to it.

Thanks~

 

Ray Hsieh

0 Kudos
Message 15 of 18
(342 Views)

Hi everyone,

 

I find a discussion about global array, shown as the following

Example on how to set an array as a Global Variable (LV2?). - NI Community

 

I have downloaded and seen the example from @Mads & @

According to these example, it seems that global array can be only constructed by For loop, shift register, case structure, Array subset.vi, and Replace array subset.vi, right?

So the memory usage can be decreased by these method?   

 

Ray Hsieh

0 Kudos
Message 16 of 18
(314 Views)

@rayhsieh wrote:

Hi everyone,

 

I find a discussion about global array, shown as the following

Example on how to set an array as a Global Variable (LV2?). - NI Community

 

I have downloaded and seen the example from @Mads & @

According to these example, it seems that global array can be only constructed by For loop, shift register, case structure, Array subset.vi, and Replace array subset.vi, right?

So the memory usage can be decreased by these method?   

 

Ray Hsieh


I'd have a look at DVRs (Data Value References) instead if I were you. They offer a lot of nice protection of the data within and are the best option to combine with the in-place structure to process that data. You can pass the DVR reference itself around in any way you like too.

 

Start with your final array, the way you want to save it somewhere, initialize it in that size, but empty, and then train to fill it up with the corresponding data one iteration at a time.

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
0 Kudos
Message 17 of 18
(295 Views)

Hi Ray,

 


@rayhsieh wrote:
  • Hide the labels of subVIs/functions. Use the context help window when you don't know them!
    • Ans: Yes, I have already tried this way. However, I have searched lots of on-line information related to the issue but still feel confuse about how to implement to my system. Such as the advice, from  Dobrinov, about not using "build array.vi" and initialize a global array at the beginning of the main vi.  

Showing/hiding the labels of functions is not related to your problem. Showing those labels only clutters the blockdiagram - you still can read that information in the context help window!

 


@rayhsieh wrote:
  • Cleanup the block diagrams! (Cleanup the frontpanels, too…)
    • Ans: I'm not sure about this correction. I have tried to clean up my code by creating sub-vis, less data lines, less indicator and less control in front panel. However, there are some indicator & control must used to transfer data between two sub-vis.

Yes, controls/indicators are needed. But you can still align them nicely on the blockdiagram as I did with some of your VIs!

You should NOT maximize windows (frontpanel, blockdiagram) to full screen, that's only annoying.

Cleaning up code helps to maintain readability!

 


@rayhsieh wrote:
  • Remove Rube-Goldberg constructs…
    • Ans: This correction is a little brief for me. Can you describe this correction in a more clear way? 
  • Don't set subVIs to reentrant for no good reason!
    • Ans: Do you mean not using shift register? 

There's a whole long thread dedicated to Rube-Goldberg code in the "Special interest" section of the forum. Read it…

 

Setting a subVI to "reentrant" has NOTHING to do with using shift registers (or feedback nodes). You always should take care of initializing them correctly - or take care of the amount of data stored within…

 


@rayhsieh wrote:

Finally, is there any idea about using a global array with enough size instead of build array vi?


I don't see a reason to have a "global" array here. Why do you want to put even more data into memory?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 18
(291 Views)