Written by

Senior Software Engineer
MOD
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=123 write $storage
2199022714000
2199022714000
USER>write $zv
IRIS for UNIX (Ubuntu Server LTS for x86-64) 2021.2 (Build 649U) Thu Jan 20 2022 08: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 20 2022 08:49:51 EST

Username: kav
Password: ******
USER>s x=$storage

USER>set x=$storage, ^myKav=123 write x-$storage
768
USER>set x=$storage, ^myKav2=123 write x-$storage
768
USER>set x=$storage, ^myKav3=123 write x-$storage
768
USER>set x=$storage, ^myKav3=123 write x-$storage
0
USER>set x=$storage, ^myKav2=123 write x-$storage
0
USER>set x=$storage, ^myKav=123 write x-$storage
0
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 2024
                                                                        11:26 AM
      Global        Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
      TEST               1               12      0 %         0
      TOTAL         Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
                         1               12      0 %         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