Written by

Senior Software Engineer
Question Ashok Kumar T · Jan 21, 2024

$Storage and Private global

Hello Community,

The process private global doesn't impact the $storage. But, Why the value has decreases at first time of initialization. 

LEARNING>write $zversion
IRIS for Windows (x86-64) 2023.3 (Build 254) Wed Nov 8 2023 13:28:10 EST
LEARNING>write "$Storage: ",$storage
$Storage: 2199023141712
LEARNING>set ^||Test="Test"
 
LEARNING>write "$Storage: ",$storage
$Storage: 2199023136848
LEARNING>write 2199023141712-$storage
4864

Just want to ensure about it.

Product version: IRIS 2023.3
$ZV: IRIS for Windows (x86-64) 2023.3 (Build 254)

Comments

Julius Kavay · Jan 21, 2024

I don't see any difference


USER>write$storage,! set^myTest=123write$storage21990227140002199022714000
USER>write$zv
IRIS for UNIX (Ubuntu Server LTS for x86-64) 2021.2 (Build 649U) Thu Jan 20202208:49:51 EST
USER>

Try the above line. Maybe you have issued one or more "set variable=..." commands between the two "write $storage" statements in your tests...

0
Julius Kavay  Jan 21, 2024 to Julius Kavay

Oh, I see, at the very first use of a (new) private global,  the storage is decremented (on my  machine) by 768 bytes. I think, that bytes will hold some management data for each provate global (name).

Instance: cindy:ICINDY
Version : IRIS for UNIX (Ubuntu Server LTS for x86-64) 2021.2 (Build 649U) Thu Jan 20202208:49:51 EST

Username: kav
Password: ******
USER>sx=$storage

USER>setx=$storage, ^myKav=123writex-$storage768
USER>setx=$storage, ^myKav2=123writex-$storage768
USER>setx=$storage, ^myKav3=123writex-$storage768
USER>setx=$storage, ^myKav3=123writex-$storage0
USER>setx=$storage, ^myKav2=123writex-$storage0
USER>setx=$storage, ^myKav=123writex-$storage0
USER>
0
Ashok Kumar T  Jan 24, 2024 to Julius Kavay

Thanks @Julius Kavay ,

Ok. Yes, both global and private global storage at the first time of initialization.  Why does it consumes minimum 8 byte(seems default and Is this Default byte size) regardless of single character(1 byte) in $storage. It consumes same or more than same byte when store in to global. Is this actual physical storage size(bytes) for the global.

 LEARNING>Set^TEST="a"
 LEARNING>d^%GSIZE
Global ^TEST
directory: c:\intersystems\irishealth\mgr\learning\
Page: 1                           GLOBAL SIZE                        24 Jan 202411:26 AM
      Global        Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
      TEST               1120 %         0
      TOTAL         Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
                         1120 %         0
                                        <RETURN> to continue or '^' to STOP:
0
Robert Cemper  Jan 24, 2024 to Ashok Kumar T

$storage refers to the partition which holds only pointers into global buffers.
while the content of the global goes only to global buffers and
consumes no permanent space in your partition. 

0