-
May 22nd, 2017, 05:49 AM
#1
Question about array memory
If I use
Global VarCol(144000,450) as double, I will get no out of memory in VB6 Windows 10
But if I use Global VarCol(144000,500) as double, the out of memory pops up. It's only a array of 144001 x 501 x double = 577 MB and I have 32GB of memory, so I don't understand that there isn't room enough for this array.
I understood I could use arrays up to 2Gb.
Thanks in advance
-
June 1st, 2017, 03:31 AM
#2
Re: Question about array memory
-
June 1st, 2017, 05:52 AM
#3
Re: Question about array memory
I don't know/use VB6 so this is an educated guess. Memory is allocated from 2 places - stack and heap. Stack memory is usually allocated for fixed size variables when the size is known at compile time. Heap (or dynamic) memory is usually allocated when the size is only determined at run-time. There is a limit to how much stack memory is available - irrespective of how much actual physical memory is available. Without knowing VB6 I'm guessing that the VB6 compiler is trying to allocate the memory for VarCol on the stack and is running out of stack memory. Is there a way in VB6 to dynamically allocate memory for an array at runtime?
Sorry I can't be more help - I only use c++ and VB6 might do things very different. In c++ I can allocate an array of 144000 x 500 OK.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
June 1st, 2017, 08:56 AM
#4
Re: Question about array memory
Always use [code][/code] tags when posting code.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|