Results 1 to 10 of 10

Thread: Array Information

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    8
    Does anybody know where I can go to find out how VB is doing arrays behind the scenes? I've been seeing some wierd things with large arrays (Arrays with 20+ dimensions) and am curious about what's going on. I'm specifically interested in how Dim and ReDim work in regards to typed arrays (Integer, string, long, etc..)


    Thanks,
    Jeremy

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    8
    APL? no.

    Its not so much that I'm using 20 dimensional arrays, its that I saw something happening that has me curious about what VB is doing under the hood. Its just visible when you start getting 25-27 dimensions on an array.

    I am looking for some resources on how VB is handling this stuff under the covers. ::shrug::

    Any ideas would be appreciated,

    Jeremy

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    WEll if it's about how it's handling the memory then a multidimensional array needs

    20 bytes + 4 bytes for each dimension + the amount of space that the items take up.

    I guess the 4 bytes is the size of the dimension. So the data is probably stored according to the dimensions
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    8
    Kedaman....

    Ok then what's going on makes no sense.

    I can dimension an array

    Dim intAry() As Integer

    Then...

    ReDim intAry(1,1,1,1,1,1,1,1...etc)

    Note: I'm not putting anything in these arrays...

    And all is fine until I gett to 20 dimensions.

    At 25 dimensions I see a noticeable amount of system resource loss...

    at 27 dimensions, I have tapped all resources

    at 28 dimensions, I get out of memory.

    I have 163 MB of ram. I am running NT. I have tried this after shuting down everything I can think of, rebooting, etc.

    I think its wierd, and I would like to know what's going on because at least on this box, VB is doing alot more than 20+4+8 bytes of memory per dimension.


    Jeremy

  6. #6
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Maybe reading this article gives you an idea. They use some stuff to let vb think a picture box is an array. It also shows what the bytes are that Kedaman talked about.
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hmm, i'm sure it eats a lot of memory at least

    ?2^28*2
    536870912

    thats 512 M Ram, should be enough for flipping out your system resources too?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    8
    Ok, I'll be embarrased now

    Forgive me for a lack of formal education but why are you doing 2^28 * 2?

    Jeremy

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    each of your dimension size is 2, from 0 to 1. And to calculate the volume of a 28 dimensioned cube or whatever you can call something like that, you multiply the dimensions, which means 2^28. And you multiply it with the byte size of a integer which is 2 bytes. that makes 2^29 bytes which is a half gigabyte.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    8
    Oh...sorry...I think I have had too much caffeine today.

    Thank you for clearing that up for me.


    Jeremy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width