SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Florida, United States
    Posts
    2,765
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Blog Entries
    1

    Variant space in memory

    The information about the range of numbers of different variant sub-types is on the internet when I do a google search.

    Is there a number of bytes that a variant uses for storage?

    I was asked this question. It implied that there is a fixed number of bytes used for any variant. Is this correct?

    Thanks,

    Kevin
    When in Florida, Don't Tampa with the code. I made this up.

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,647
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    For the most part, a programmer is not concerned about the size of the sub types than the variant itself. But to answer your question, there is a fixed number of bytes depending on the system of the variant itself.

    As for the actual size used by the variant, I don't know, but I can make an educated guess. If you think of the variant is basically 2 things, 1) a memory address, and 2) some meta data that tells the scripting engine what type that variant is.

    Breaking down the pieces that make up a variant.

    1st) The memory address size is determined by the number of bits the architecture supports, 32 vs. 64 bit, etc... So the memory pointer to the actual location of the variable might be around. (let's use a 64 bit windows 10 system.)

    2nd) There are 13 subtypes that, that requires at least 4 bits of data to track. Round that up to the nearest byte, since it can

    3rd) For types like Strings, and arrays, there is a length that the system has to store. VBScript allows 2^31 number of blocks., so that's an additional 32 more bits used.

    So basically, you have (8 + 1 + 4) + (number of bytes requires by subtype). So that's what it would require at a minimum.
    David Lai
    SDET / Consultant
    LinkedIn profile

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:16 PM.

Copyright BetaSoft Inc.