10-12-2023 03:46 PM
I'm trying to understand what I am doing.
I'm working on something that uses up LabVIEW memory such that I get an out of memory error pop-up, and I'm trying to understand it. To this end I created a vi that I am posting. I have a special request.
Please explain to me, as best as you understand it, what this posted vi does, even if you think it is dumb and doesn't make any sense.
Thank you fellow LabVIEW users.
Note: This VI is LV2018.
Solved! Go to Solution.
10-12-2023 03:50 PM
Here's the block diagram:
10-12-2023 03:53 PM
Here's the front panel:
10-12-2023 04:02 PM
The CLFNs are:
DSNewPtr: uintptr_t DSNewPtr(int32_t size);
MoveBlock: void MoveBlock(uintptr_t pSource, int16_t *pDest, int32_t size);
DSDisposePtr int32_t DSDisposePtr(uintptr_t p);
in order from left to right. Four such are stacked vertically, but dataflow is dataflow.
All functions are from the LabVIEW library. (Enter "LabVIEW" for library name or path.)
Also, the vi contains a Data Value Reference and a read/write mechanism for such, or at least such as I understand it.
10-12-2023 04:06 PM
Here's a successful run of the vi:
10-12-2023 05:41 PM
I have not measured the memory usage of your VI. You duplicate the 140e6 Byte buffer about 16 times ... not really a good idea.
10-12-2023 06:12 PM
I looked at the memory usage, assuming I used the newly discovered tool correctly (under tools - profile - performance and memory),
Here's start:
Here's finish:
Those are killobytes.
Therefore, that's 1960016.44KB = 1.96 GB
Correct?
10-12-2023 06:19 PM
Will you please elaborate a little, Martin?
10-13-2023 01:29 AM - edited 10-13-2023 01:41 AM
@*3d0g wrote:
Will you please elaborate a little, Martin?
It's difficult to tell what the compiler actually does.
I counted the knots plus the FP elements. In reality, the footprint may be smaller, but I'm certainly not entirely wrong.
BTW: I do not really trust the labview performance monitor and I do not trust the "show buffer allocation". In examples like this, the information should be compared with the allocations reported by the operating system.
(corrected the picture (position of memory allocation 2,3 and moved 4,5,6,7 to DSNewPtr)
10-13-2023 01:52 AM - edited 10-13-2023 02:36 AM
Hi 3d0g,
@*3d0g wrote:
Please explain to me, as best as you understand it, what this posted vi does, even if you think it is dumb and doesn't make any sense.
What's the point of creating the DVR?
You init an array, put that into the DVR, then you read the array from the DVR, then you dispose the DVR. There is no place where you actually use the DVR to manipulate data inside the InPlaceElement structure…
The main usage of a DVR is to provide a "pointer" (aka reference) to a data structure so you move that small reference instead of large data structures along the DATAFLOW. You manipulate the data referenced by the DVR inside an IPE structure.