Reputation: 1059
I'm currently supporting a VB6 application (that we are replacing, but it's a slow process!) that is running on several servers. Can anyone tell me please what the maximum amount of memory of VB6 process can address is? We are using a variety of operating systems:
I've tried using resources like this: https://blogs.msdn.microsoft.com/tom/2008/04/10/chat-question-memory-limits-for-32-bit-and-64-bit-processes/
But I'm skeptical if this is accurate due to it discussing .NET based applications, however I can't find anything more on point than this.
Upvotes: 2
Views: 1739
Reputation: 13267
It is hard to take these "What if Superman got in a fight with God" questions too seriously. Long before this becomes a concern you should have moved from memory-resident data structures to a disk file or a database anyway.
But even without linking with /LARGEADDRESSAWARE and booting into 3GB mode a VB6 program can address quite a bit of data on 32-bit Windows.
Option Explicit
Private Sub Main()
Const MAX_BYTES As Long = &H63700000
Dim Bytes() As Byte
ReDim Bytes(MAX_BYTES)
Bytes(MAX_BYTES) = 255
MsgBox "Success" & vbNewLine & vbNewLine _
& "Bytes(MAX_BYTES) = " & CStr(Bytes(MAX_BYTES)) & vbNewLine & vbNewLine _
& "MAX_BYTES = " & Format$(MAX_BYTES, "#,##0")
End Sub
Result:
Success
Bytes(MAX_BYTES) = 255
MAX_BYTES = 1,668,284,416
The linked blog post is correct in pointing out the limitations of a .Net process and their inability to cope with using large amounts of data. Scripting engines like .Net just are not built for these things, and don't underestimate the overhead of the gigantic libraries even the simplest .Net program drags into its address space.
Upvotes: 2