Data Space

From LabVIEW Wiki
Jump to: navigation, search

Data Space is a continuous block of memory, existing for each VI file, which stores values of instantiated data types.

Data Space contains filling for all data elements. The data elements are instances of data types defined by Type descriptors. Type map is used to assign place in Data Space for Type descriptors.

Longer explanation:

  • Like in all languages, you can define data types in LabVIEW. You don't need any action to define boolean - you just place the control which uses it, and data type is added automatically. But compound types, like Clusters and Arrays - these you need to define manually.
  • LV stores all data types used within a VI in form of Type Descriptors (TDs). There is a table of these in every VI file.
  • When an instance of data type is required - real variable needs to be created - the TD is added to Type Map. Type Map is just another table, which maps TDs into Data Space. That Type Map Entry is a confirmation that there is an area reserved in Data Space for the variable, and it also points to the specific place where data starts.
  • Data Space is a continuous block of memory, which consists only of data. Reading Data Space requires information of what is stored where - so Type Map Entries are required to give meaning to the binary values stored in Data Space.

Some of the types stored in Data Space are not linked directly to user created code, and are LV internal data instead. For example, the data space always contains a block of 51 integer values - these are settings internal to LabVIEW, called DSInit Table. It also contains a list of DCOs - objects which contain selected properties of controls and indicators from Front Panel, and are retained even when FP is removed form VI file.

Offsets of specific items within data space block do not change when values within data are modified. This means that any variable size values (ie. strings) are not stored directly in the continuous data space, but are allocated separately and data space only contains pointer to the real data. This means that data space is size invariant, as long as Type Map remains unchanged.

Data space of a VI file can be viewed in detail within Heap Peek window.