06-14-2007 02:44 PM
06-15-2007 06:06 AM
06-18-2007 09:51 AM
Hi billings,
The Show Allocations Buffer tool should indeed work for OOP. I opened up some of the examples in 8.2.1 to play around with it and it was working. You won’t get the dots on methods because, since it is the same type of input as output, methods use the same memory. The memory is allocated for each data value – not by reference. I suggest reading the paragraph How does OO fit with dataflow? (The Great By-Value vs. By-Reference Debate) in this article: LabVIEW Object-Oriented Programming: The Decisions Behind the Design. That article links to OOP FAQ, which also links to some presentations on it for further information. Let me know if you need any more information (and if so, what version of LabVIEW are you using)!
Stephanie
06-18-2007 11:30 AM - edited 06-18-2007 11:30 AM
Thanks for the response. Yes that is the article I was talking about having read already in my first post. But it doesn't make it clear exactly where in a labview context memory will be duplicated. It only says memory is duplicated when the default value is changed. It does not give practical examples or say at all if classes are in-place in methods. And I get the concept that memory is allocated by value, but that article makes it seem like the only time new memory is allocated is the first time you give a class a non-default value. But what if the class already has a non-default value? Does it still duplicate memory or does it keep the same memory? So I wanted to make sure the show buffer allocations was working properly. I am using labview 8.2.
Here is what it looks like so far:
LV Classes duplicate memory when:
1. The are passed in or out of a non-method vi.
2. The first time (but only the first time) the default value is changed in a method vi. This typically shows up at the output terminal of an "Initialize" type of method where data is first bundled into the class.
3. If a class is put into another data type, like an array, memory is managed just like any other array. It duplicates memory in all the normal places.
Other than that I don't see any duplication of memory with LVOOP. So LV Classes do NOT duplicate memory when:
1. They are passed in or out of method vi's.
2. Their value is operated upon within method vi's. Bundling data into a class does not create a new instance of the class in memory, except for the first time you modify the default value.
Is all of this correct? Because I can't figure out exactly what is happening. And if you have inheriting classes you see dots from every override vi and not just the one you are looking at. So its really hard to figure out what's going on with memory. Does memory get allocated for all possible override vi's at any call to the root inherited method?
Message Edited by billings11 on 06-18-2007 11:45 AM
06-19-2007 04:13 PM
Hi billings,
In short, memory is allocated when any value that could be referenced again is changed. So in order to not change a default value, whenever the default value is changed, new memory is allocated. If you change the number (method vi), because you won’t need that original number, then it uses the same memory. Default values though you will always want for whenever you start up the program, so those do not change, hence the new memory allocation. So your list looks correct. And yes, memory gets allocated for all possible override vi's at any call to the root inherited method. This is sort of a "just in case" it will need memory it goes ahead and sets some aside. I hope this helps.
Stephanie
06-20-2007 05:58 AM
12-05-2007 12:28 PM