PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → on Memory Space
on Memory Space
Débuté par Binod Lohani, 12 jan. 2018 12:31 - 2 réponses
Posté le 12 janvier 2018 - 12:31
Hello Gang !
Say,
stMyStructure is structure
s1 is string
s2 is int
s3 is boolean
...
...
...
End

Now Does this stMyStructure Occupy Memory space ?? How to find it ??

After initiating the variable
stRec is stMyStructure
stArr is Array of Structure

Now (I haven't Stored Any value to the Variable yet), Does these Variables stRec and stArr occupy Space in Memory ?? How to find it how much is occupied ??

And Now After Storing Values to the Variables stRec and stArr how Much Space would be Occupied in Memory ?? How to find it ??
Thanks !!
Posté le 12 janvier 2018 - 13:51
Hi

AFAIK,

stMyStructure is structure
s1 is string
s2 is int
s3 is boolean
...
...
...
End
Now Does this stMyStructure Occupy Memory space ?? How to find it ??


NO, it's a DEFINITION hat exists in your source and will be used only when declaring a variable.

After initiating the variable
stRec is stMyStructure
stArr is Array of Structure
Now (I haven't Stored Any value to the Variable yet), Does these Variables stRec and stArr occupy Space in Memory ?? How to find it how much is occupied ??


YES, the exact same way than when you are doing i is int on 4.... As soon as you execute that code, 4 bytes are allocated/reserved for the variable. And there IS a content anyway, the default value for this type of variable for an int, it's ZERO).

>And Now After Storing Values to the Variables stRec and stArr how Much Space would be Occupied in Memory ?? How to find it ??

It depends on the variable. An int on 4 uses 4 bytes, a variable length string uses a variable memory (based on the length), a fixed length string uses the declared length (+/- 1 depending on the type pf fixed length)

Of course, this does NOT take into account the system pointers that are use by the variable management system, as SOMETHING has to keep track of the nameaddresses of all that.

Best regards
Posté le 12 janvier 2018 - 14:49
Did you try the get that info using the Dimension (Function)?

https://doc.windev.com/en-US/…