LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having Issue with Array Resizing

I am working with a LabVIEW-Python interface, using a LabVIEW DLL to perform operations called from Python via the cffi library. Memory allocation occurs before passing the inputs to the DLL, and resizing happens after the DLL processing completes. Both operations are handled within the Python script using LabVIEW's internal Array Resize function.
 
However, resizing the array to 0 elements does not work. When I attempted to use the DSDisposeHandle (DeAllocate) function instead, it caused a crash, which is why I reverted to using the Resize function with a size of 0. I am using LabVIEW 2021 SP1 (64-bit). I want to understand why resizing to 0 fails. Is this behavior intended by design in the LabVIEW memory manager, or am I implementing it incorrectly?
0 Kudos
Message 1 of 4
(115 Views)

Hi Dhatshayini,

 


@Dhatshayini wrote:
am I implementing it incorrectly?

How exactly did you implement "it"? Mind to share some code?

 

The ReshapeArray works as expected in LabVIEW:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(106 Views)

You need to show what you did. Memory management of LabVIEW data is not just something you can vibe code. This listens very closely and there is more to it than just calling some function randomly.

 


@Dhatshayini wrote:
I want to understand why resizing to 0 fails. Is this behavior intended by design in the LabVIEW memory manager, or am I implementing it incorrectly?

YES the LabVIEW Memory Manager definitely can do this and YES you are implementing something wrong. But without looking at the actual code both for your LabVIEW DLL and the Python FFI interface, we can only say these two things.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 4
(61 Views)

@Dhatshayini wrote:
I am working with a LabVIEW-Python interface, using a LabVIEW DLL to perform operations called from Python via the cffi library. Memory allocation occurs before passing the inputs to the DLL, and resizing happens after the DLL processing completes. Both operations are handled within the Python script using LabVIEW's internal Array Resize function.

It is not clear at all how your code is layered and what happens where. What parts are graphical and what parts are text based?

 

So you have a DLL built in LabVIEW that you call from python. At the same time, you give conflicting information where the "resizing" happens (inside the DLL as a last step after processing? After the dll in the calling code?). Does the DLL have python nodes? Is the caller again a LabVIEW program using a python node? Something else?

 

As has been said, there is no "internal" (sic) LabVIEW resize function, (except for "matrix resize") just "reshape array" (which can also do other things (trim, pad, change number of dimensions, etc).

 

What's the logical purpose of the resizing?

0 Kudos
Message 4 of 4
(21 Views)