Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 1 Monat, 1 Woche
Letzter Beitrag:
vor 1 Monat, 1 Woche
Beteiligte Autoren:
Paulo Oliveira, Fabrice Harari, Binod Lohani

on Memory Space

Startbeitrag von Binod Lohani am 12.01.2018 11: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 !!

Antworten:

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

von Fabrice Harari - am 12.01.2018 12:51
Did you try the get that info using the Dimension (Function)?

https://doc.windev.com/en-US/?3013022

von Paulo Oliveira - am 12.01.2018 13:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.