LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unused variables: Memory usage and processing speed concerning Statemachines

Hello everyone,

 

I currently reviewing my project and some questions about my datahandling came up. I have a Main-Producer and several Consumers. Every Consumer has its own Class where consumer specific data is handled. This classes inherit from the Dataclass. 

statemachines.png

 

Example: 

  • Consumer1 creates a huge array of waveforms 
  • Consumer2 creates a String

How does Labview handle the empty (Null?) variables? Is each variable created and initialized OR does it just reference the object until they are used?

 

Most of the time the consumers do not need all entries of the dataclass, but are still accessible. My worry is that LV created a huge object with empty references for each consumer even that the variables are never used.

0 Kudos
Message 1 of 2
(2,048 Views)

A value will have it's default value when it's created.

 

A value in a class' private data will have it's default value.

 

Unless you have thousands of objects, containing tens of 'empty' objects I wouldn't be too worried about performance or memory.

 

It is questionable if the parent should have items that are not used by children. I'd think a Consumer class contains a data object, not inherit from it. With inheritance, you should be able to say "child" is a "parent". Like "cat" is a "animal". "Consumerclass1" is a "Dataclass" doesn't ring very well. "Consumerclass1" has a "Dataclass" sounds a lot better. "Consumerclass1" uses a "Dataclass" could also work.

0 Kudos
Message 2 of 2
(2,000 Views)