12-12-2016 03:02 AM
I am parsing XML files using the dotnet XML properties and methods.
The question is, whether I have to close each reference I open vie property nodes and invoke nodes, or is it enough to close the reference of the entire document at the end of the parsing?
If not, I have to close each and every reference to nodes, attributes, items etc...
Madottati
Solved! Go to Solution.
12-12-2016 03:10 AM - edited 12-12-2016 03:10 AM
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
12-12-2016 06:19 AM
@Blokk wrote:
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
Darren was referring to LabVIEW objects. .NET references are a different story. Yes, you should close the references when you are done with them.
12-12-2016 06:25 AM - edited 12-12-2016 06:26 AM
@crossrulz wrote:
@Blokk wrote:
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
Darren was referring to LabVIEW objects. .NET references are a different story. Yes, you should close the references when you are done with them.
@crossrulz wrote:
@Blokk wrote:
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
Darren was referring to LabVIEW objects. .NET references are a different story. Yes, you should close the references when you are done with them.
Did you watch that part of the video until the end? Darren also mentions .Net references, and stating that you need to close this references. This is why i posted this video. It gives a nice overview about when and when not you need to close references...
12-12-2016 06:28 AM
@Blokk wrote:
@crossrulz wrote:
@Blokk wrote:
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
Darren was referring to LabVIEW objects. .NET references are a different story. Yes, you should close the references when you are done with them.
@crossrulz wrote:
@Blokk wrote:
Instead of trying to answer myself, I bring to your attention a much more experienced programmer, see this video from 29:25 -->
https://youtu.be/LcLyl3Xtp3Y?t=29m25s
Darren was referring to LabVIEW objects. .NET references are a different story. Yes, you should close the references when you are done with them.
Did you watch that part of the video until the end? Darren also mentions .Net references, and stating that you need to close this references. This is why i posted this video. It gives a nice overview about when and when not you need to close references...
No, did not watch the video. But I did not remember Darren mentioning .NET references when I saw the presentation. So my apologies.
12-12-2016 06:37 AM - edited 12-12-2016 06:46 AM
No need to apologize 🙂 I posted that video because I think an overview of a topic is even better than only confining the answer to a specific question (closing .NET nodes). I really enjoyed this video, I have learnt a lot from it! 🙂
edit: by the way, just for the "reference", see the pdf from here: http://forums.ni.com/t5/Community-Documents/An-End-to-Brainless-LabVIEW-Programming/ta-p/3548039
Slides 25-26-27...
12-12-2016 07:11 AM
And also for reference, there is this article. It does not mention .NET, but still some good info.
12-12-2016 08:06 AM
If that is the video of Daren that I watched I belive he left out the clue that will let us decide about references "of the future" that are not explicitly documented in white-papers and KB articles.
I posted the clue in this thread but failed to attribute that knowledge properly as originally being shared by Rolf.
In short, cast the ref num to an I32 and display the value on the FP. If the number changes each time to create the ref, it needs thanged. If it is staic, no need to close.
The other caveat that I should add is that every time a ref is created a small amount of memory is allocated that only get released when the application goes idle. So try to create refs only once and close only once to avoid a vert slow memory leak (ho small? repeatedly opening aclosing a VISA ref took a test program the entire week end to goble up memory). While trivial in applications that are intended to run for an extended perior of time, it can make a difference.
Done with my notes.
Ben
12-12-2016 10:08 AM
@Ben wrote:
...
In short, cast the ref num to an I32 and display the value on the FP. If the number changes each time to create the ref, it needs thanged. If it is staic, no need to close.
...
Well I certainly lived up to my typing rep with that post!
The previous should have read:
In short, cast the ref num to an I32 and display the value on the FP. If the number changes each time it is created the ref, it needs to be closed. If it is staic, no need to close.
Thank you for reading what I intended and not what I typed.
Ben