04-04-2021 09:28 PM
I in the BBS of continuous running VI will lead to increased memory, increase the dispose doesn't work, is there a good way to everybody, thank you
04-05-2021 09:54 AM
What does "BBS" mean?
The rest of the sentence doesn't make any sense in English. I suppose it is a poor translation from your native language.
What are you really trying to do here?
Why do you need to use a memory stream?
When you have a constructor inside the loop, then you are "constructing" a new object every iteration. So it makes perfect sense why you'd have an increase in memory as the program runs.
04-05-2021 05:13 PM
@RavensFan wrote:
What does "BBS" mean?
The rest of the sentence doesn't make any sense in English. I suppose it is a poor translation from your native language.
What are you really trying to do here?
Why do you need to use a memory stream?
When you have a constructor inside the loop, then you are "constructing" a new object every iteration. So it makes perfect sense why you'd have an increase in memory as the program runs.
I think memory streams are used to write a bitmap to a picturebox, or whatever .NET calls it. It's been a while since I've thought about .NET, but I believe You have to be very careful to close references and stuff, especially when it comes to memory streams and pictureboxes, or you rapidly run out of memory. I learned the hard way when programming my video game. Because it was updating a fairly large picturebox at a frantic pace, it chewed through 32GB of memory before I could hit the abort button!
04-07-2021 08:52 AM - edited 04-07-2021 08:53 AM
Yes, close the references:
This does not close the Stream, nor the Image! It closes the reference to the Stream, and the reference to the Image. If (when) there are no more references to the Stream or Image, the object is removed from memory.
04-07-2021 08:55 AM
BTW. Any reason you want to use a .NET control?