Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Program Too Big To Fit In Memory

Once upon a time, I wrote an application that reads HTML files, looks for information, and writes it to an output TEXT file. It works just fine.

Yesterday, I made a copy of that application, changed it to read Excel files instead. It looks for a whole lot more information and does validation, etc, but the main concept behind the code is essentially the same.


Today I went to compile this new EXE for the first time (VB6, Windows XP) and when I tried to run the EXE from my "dev machine" (it's a microsoft virtual machine), I got the quick command-window flash that turned out to say "Program too big to fit in memory". The icon isn't right for the EXE -- it should be the "eyeball" standard VB icon, but I'm getting the generic "this is an application" square icon.

The EXE itself came out to 88 KB. Task manager shows that I have 261,616 K of physical memory.
- After rebooting, memory available = 42,700
- When running VB alone, memory available = 30,800
- When running VB with the source code open, memory available = 28,500
- After launching the app through VB (but not doing anything with it), memory available = 28,400

I tried recompiling, I tried using the VB6 tool to create a setup for it and running that on my "real" machine (the host of the VM), but no go.

The project type is a Standard EXE, compiling to Native Code (optimize for fast code), and it only has one form with drive and directory controls on it.

References: VBA, VB runtime, VB objects, OLE automation (all of these are default); MS Excel 11.0 Object Library.

Components: MS Windows Common Controls 6.0 (SP6) (by default)

UPDATE! I created a new project, added my form and the Excel reference, compiled it, and it worked. So it seems my VBP file was corrupt somehow. WHEW!

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Much Memory Does My Program Use?
Forgive me if this was posted in the wrong thread...

I was wondering if there is any way I could find out how much memory my game uses. Specifically, I am using a set of variables to determine the maximum amount of objects that the game generates during run-time; If I set it to 1000, then 1000 'Actor' classes are possible, which means there would also be 1000 inventories, each capable of holding 100 objects... also, each enemy can have up to 10 bullets, so there's a further 10 x 1000 bullets to consider... Each of these things are created by using a UDT with thier own set of variables, so the variable space required must be quite phenomenal... and I would really like to find a way of knowing exactly how much variable space is required for the game each time it is run... so that I can change the limits to these objects and easily know where to draw the line. Does anyone have an easy way of doing this??

Memory In Use By A Program?
Hi, is there a way to find out how much memory a program is using? Thanks

Memory Taken By Program
I never looked at the memory taken by an application but now it is an issue for an application.
The application is taking 8 megs of memory when it starts up. I took this information from the task manager in Windows 2000.
What changes can I make to reduce the memory taken by the application ??

Program Too Big To Fit Memory!!
firstly, i apology for this post, because i dont know whether i should post this thread.......

i'm writing a program using foxpro 2.6 and i'm facing one the program i call a batch job to execute...


when the flow reach the third line, it will display one error said that "program too big to fit memory"...................what is the problem of this? I alr check all the thing, the batch job command is correct, code no problem.......anyone can tell me why?

Run Program In Memory?
Not to long ago the Code Red worm was running rampid. I noticed that one of its key qualities is it's ability to run in memory. Is it possible to create something of this nature in VB. Maybe a program that spawns another program but does not place it on the hard drive; it runs in memory and when it is done there is no trace of it on the system? Also, Code Red had the ability to alter its self from time to time. How can a program "recompile" its self like this? Can this be done in VB?


PS: No, I don't want to be a virus writter. I just think the abilities of Code Red were cool and would like to understand how it works.

How Much Memory Does A Program Take
Is there a relatively easy way of seeing how much memory a program is allocating to itself when it starts up, or does anyone know of a 3rd party product to demonstrate this ?


Memory Used By Any Program.

Is any way to determine the size of memory used by specified program?

John, 14 years old

The Program Keeps On Memory
Hi people!!

i`ve been developing a vb database program. when its was small, the program unload good, it didn't keep on memory, but now, when the program grow a lot, when the program exit, it keeps on memory, I want to know if the are a way to get where the program is not unload.


Vb Program Hanging In Memory
I have just created a vb program which contains 3 forms - 1 main form and 2 child forms. The main form has 2 buttons which launch the child forms using the frmMain.hide and
Everything seems to be working fine - the problem arises when I go to a child form. If I close the exe by using the x (in the upper right corner), the program stays in memory.

Is it possible to actually "close" the project out completely so that nothing is left in memory?

Thanks for any thoughts

Program Taking Too Much Of Memory !!!
Can neone tell me when does "out of memory " and the windows virtual memory low error arises .
Can it be due to the number and type of variable one uses in the program ??

Reading Another Program's Memory
Ok here's the deal. I work for a company where we need to gather information from one program and bring it into our own program. The programs that I am trying to capture data from are terminal emulations (reflections, rumba...) Currently we are trying to do this with the clipboard but it is very slow and cumbersom. The other issue is that not all emulators allow access to the clipboard.
What I would like to be able to do is to read the emulation screen directly from memory. I know that the emulation programs store the screen at the same offset from the begining of the program. What I need is to be able to find the begining of a another program in memory and then read memory locations from that offset. I would like to be able to do this in VB6 if possible.

As I see it i have 3 options:

1) find the program and read the memory
2) load the program within my programs memory and read the memory
3) Write a C based DLL to do the memory reads and use the data in VB

My problem is i really don't know how to do any of these. So if anyone has any suggestions that would be great.

My Program Takes Up A Lot Of Memory :(
My program in its "Idle" so to speak form is taking up tons of memory after a while...I left it on since last night and when i got home at like 3:30 it said virtual memory was low (the computer said that) and the task manager showed my program had like 224k usage. I was wandering how you keep that at a bare minimum...Cuz when i open it only for a little bit its like 20k usage or less. It only goes high when i leave it on...

is there a way i can fix this?

Program Remains In Memory?
Could anyone give me some pointers please.

I've got a routine that has an exit button. In the code I have this

Timer1.enabled = false
unloade me

The trouble is, when the person clicks this button, on occasions the program remains in memory as process.

What else am I supposed to be shutting down to make sure everything ends cleanly. The program uses multiple forms etc.



Making Program Use Less Memory?
Does anyone have any tips/coding that would make a program more memory efficient. Maybe something that will dump memory/release resources when a process is complete. Pretty much making sure the program cleans up after each process. I noticed on some of my apps if they run for a long period of time say 2-3days the Memory usage that taskmanger shows for that app will start to increase more than usual.

Program Stays In Memory
Could someone be so helpfull as to look at my small program and see if they can figure out why Excel, and the program itself, resides in the task manager after everything is closed? I'm setting all the objects to nothing (I think) but it still doesn't work. Thank you in advance!

Removing Program From Memory
i am accesing msaccess forms using vb code.....once i run my application a copy of msaccess stays in memory.......when i run the program next time it doesnt work properly......but once i remove the copy of msaccess from memory it works can i remove the msaccess program from memory?

thanks a lot


Load Program Through Memory?
I found some source for a project. You can store files in a file. I have an exe stored and I need some way to load it through memory. (for protection) I have saved the bytes to a file, but then someone might be able to just grab the bytes and uncompile or whatever they do. I was thinking load it in memory or something...

please help,

Program-already-in-memory Check

Hmmm... I wanted to ask, does somebody know a way to check in VB whether the running program is already running?


Free Up Your Program's Memory
Lemme explain what I mean. I have a simple PRELOADER program that sits in my systray. This PRELOADER only sits there to monitor hotkeys and launch an external application. Problem is, it uses about 4 mb of memory. It uses about 2mb to start out, and then after an application has been launched and it's menu and msgbox items have been invoked, it goes up to about 4 to 4.5 mb. The only and only form is hidden from view and it does not contain a border style and does not show itself ever. I noticed that if i have a regular form and I minimize it, the memory is freed and usage goes down to about 462kb and then once I used the program again it'll go back up to about 2.5-3mb usage and if i minimize again, it'll go back to about 462kb of memory usage.

My question to you all, is there a call to the API that windows uses to free up memory when you minimize. Can I replicate this call ? If so how ? I can't simply have the form go from normal state to minimize because the form is hidden and u can't perform these operations on a hidden form.


Free All Memory From Program?
I am working on a program that is memory-intensive, and although I will be going through trying to make it as effecient as possible, I believe it will still use a lot. It will need the ability to restart, and therefore *basically* perform the same thing with different data again.

Is there anyway I can "clear" all data from the memory currently associated with the program, or ANYTHING that would help me out... thanks!

Vb Program Does Not Free Up Memory
Hi All

My application loads controls (command buttons) at runtime, with the top, left, caption, etc. properties. I do this with for/next statements, which I close afterwards.

After I have run the program a few times, my pc becomes very sluggish, and vb has alreay reported that it is out of memory.

How can I get my app to free all 'memory it is using after it has

Any help would be great.


Program Memory Requirements
As a matter of interest:

How would I be able to determine the minimum memory and clock speed requirements of a program I have written in VB.

e.g. 16Mb RAM, 450MHz

It's to put on the side of the packaging I'm designing for my latest work of genius

How Do I Allocate Memory For My Program
I have a bit of a problem. I have written an app. for our office and it works fine. My problem however, is with a piece of old 16 bit software that everyone in the office also runs. The stupid thing seems to lock all of a computers memory. For example, I run a PIII 700 with 256 MB of RAM and a 25 GB harddrive, and the rogue app pushes my system resources down to 20%. Now the app. that I wrote is really light and uses one .dll that I wrote for it but when this 16 bit program is running, it just won't work right. I am wondering if there is a way that I can allocate my own amount of virtual memory so that it will run, even if this other program is running. It must be able to be done, because MS's software runs (though a bit slower), and generally can even free up some of those capture resources. Any suggestions??

VB DLL Memory Management When Used In A C++ Program

We have a C++ application that uses an OCX component written in VB. We watch our memory usage in performance monitor. We can see that when we use the OCX, memory increases then periodically returns back to a minimum level. This cycle continues indefinitely. It looks like to us that the VB OCX is using internal garbage collection to manage memory in the OCX. Can anyone confirm (or refute) that this is actually the case, in other words if we load an OCX, COM, or regular VB DLL in a C++ program, the VB memory management is used for that DLL?


Program Memory Usage
Hey guys. I want to get your thoughts/opinions/tricks/tweaks on this issue I have with a VB program I just compiled. It's a patient scheduling program for the hospital where I work and it accesses an Oracle database. When I ran the program and checked the task manager to see how much memory it was using, I was shocked. This program uses almost 14MB of memory!

Now, this isn't an issue for my development machine, since it's pretty beefy. But the clerks in the hospital who actually use the program don't have very good machines. In fact, they pretty much suck.

So, how can I get that memory useage down? Users are complaining about the performance... The program code itself is rather large - 44 Forms, 2 Basic Modules, 23848 lines of code. It reads in an array of 4600 doctors from the database. Any ideas?

Thanks in advance!

Need to set up a website?
For really great, inexpensive
webhosting, visit

Memory Resident Program
How to make a VB application Memory Resident?

I know how to put it in system tray and in start programs. But, I want it to make the real memory resident program so that the user will not be able to remove from the Startup programs. Also, how to make it invisible when a user press 'ctrl+Alt+Del'. Please reply ASAP.


Control Other Program Memory

I am new to here.
How to read and write other program's memory in main memory? which tools I should use?

Thx. in advance.

I Need To Include A Memory Editor In My Program. Help?
Hey there, Iím developing a tool for an admin system and I need to include a basic memory editor within one of the forms. Could anyone help me with the format/code for a simple editor that can search 1bit/2bit/3bit/4bit and 8bit static addresses? All I need is it to target a certain process (while it is running in the memory) and be able to search and edit the values. (Using vb6)

I need it to include a list of ALL the processes running in the memory (preferably a pull down list) Then when it is selected, a search tool. Within the search, another pull down list of the bit type is required then an input box for the value that is to be searched for. After this is completed I need a simple field showing the results: This can be edited and when done so, it immediately changes the processes memory.

I do not have much skill in creating memory editors hence asking for help. (Replies needed quickly!) Any help would be highly appreciated.


Program Crash - Memory Can't Be Written
I am trying to enumerate windows that are visible. I have done it before but I'm trying to recreate it again but it is just crashing because of some memory problem I suppose. I will post the procedure EnumVisiWindows() here and if you need further code, I'll will upload the module also.
Public Function EnumVisiWindows() As Boolean

Dim inthWnd As Long, thisAPPhWnd As Long
Dim tempTitle As String, tempFindwin As String

'MsgBox "boutto start"
thisAPPhWnd = frmServer.hwnd ' Don't won't to show this one?

ReDim servWindows(0) ' Clear all old values if any &
' begin this by setting it to 0.

DoEvents ' Bout to start, so let it redim good.

For inthWnd = 1 To 10000

DoEvents ' Rest. Let everything do what it needs to do.

tempTitle = GetWindowTitle(inthWnd) ' Get window text (caption).

' Receive hWnd of tempTitle, which is the window text of inthWnd...
tempFindwin = FindWindow(vbNullString, tempTitle)

' tempTitle is something and it's not frmServer's hWnd...
If (tempTitle <> vbNullString) And (inthWnd <> thisAPPhWnd) Then

DoEvents ' Wait up.

' tempTitle's hWnd is not zero and it is a visible (to the computer user)...
If (FindWindow(vbNullString, tempTitle) <> 0) And (IsWindowVisible(tempFindwin) = 1) Then

' The window is enabled and can accept mouse/keyb input...
If (IsWindowEnabled(tempFindwin) <> 0) Then

servWindows(UBound(servWindows)) = tempTitle

ReDim Preserve servWindows(UBound(servWindows) + 1)

MsgBox "redim preserve"

DoEvents ' Rest.


'Debug.Print "1"

End If


'Debug.Print "2"


End If


'Debug.Print "3"


End If

Next inthWnd

ReDim Preserve servWindows(UBound(servWindows) - 1)

'Send windows
MsgBox servWindows(UBound(servWindows))

End Function

My Program Has A Large Memory Footprint...
I've made a program.The .exe is about 860KB.

However when i check the task manager, i see that it consumes around 17MB in memory.

I know that besides the .exe there are also some runtimes that are loaded from the program.

Is there any tips for reducing this memory consumption ?


ERROR Out Memory : Run Program Using Manifest
Hello all,

i finished create the application with vb 6.
for my application i use manifest file to create xp skin on my application.
whan i run my program on source (not on application) i'm not found the error.
But when i run my application (applicaton.exe) my program error :
Error description : Out Memory
Error Number : 7

and if my manifest not on my application it can run well.

what is wrong with my application ?


Save String To The Program Memory.
I've read about this before but not sure what to search for.

How do I save a string variable to the application's memory?

Basically, instead of creating a file called lastopen.ini I want to save the commondialog.filename string to the app memory so that the next time it opens it the commondialog remembers where it was last at.

VBA Program Hanging Consuming All The Memory
Hello All,

I know this question is related to VBA Excel Coding and not VB but please dont move this question to Office Development. If someone can help me in making my code better then please visit the following thread :


Memory Leak / Optimizing Program
How can I find out whether my program has any memory leaks? What are the general causes of memory leaks?

What are some ways of optimizing a vb6 application?

Close The Program - The Process Is Still In Memory
Hi guys!

when I close the program through the close button (the one near the minimize/maximize) the program stays in the memory.
is there a way to run commands when someone force close the software?

when I close the program through a regular button I have made (with the End command) it closes and the memory clears.

any idea anyone?

thanks for your time!


Unload Program From Memory Completely
How do I get my program to completely shut down? Whenever I press the close control on the title bar, it just hides my form and then leaves the program running in the background. The End statement does not work for some reason...I put it in the unload event for the form. Any help would be greatly appreciated.



Checking Program Is Running In Memory...
anyone know who to check what program is running in the memory? so the user doesn't load x2 of the same program??

thanks for the help.

How To Write Memory-resident Program In VB.
I want this program to stay in memory like anti-virus programs after closing the application.

Any ideas?

Thank you.

Destroy All Memory In Program What Is Cached
Hi there,

I need to destroy every variable and cached memory what my form uses with a function while the program is running.
How can i do this?

Thanks in advance

Edited by - Devoney on 5/15/2005 5:09:24 AM

Allocate Memory Usage Of My Program
In my vb program, i call a function
when the function is running it takes the 100% cpu usage
is there anyway we manually allocate memory usage for my program through coding

for this problem, other applications hang and run properly until my program finishes process

pls help me, and give me a sample code

Allocated Memory Size Of Program.
As the title says how do you set/adjust the size of memory that a program/application can use?

I am in the process of writing a program with a flex-grid of 1000 by 500 cells and a few dim variables of the same size.
When I run the program (in the development window or as a exe file) the program produces an error message;

Out of memory (err 8)
Unable to Allocate Memory For FlexGrid (err 3006)

If I reduce the size of the flex-grid and variables I can run the program with no problems.
(I can even run a number of copies at the same time)

I don't know what command sets the size of memory?

Can you use this command in the main form
or do you need to put it in a bat file that sets the memory size and then loads the exe file.

On the Acorn RISC operating system the command is;
*WimpSlot -min size -max size -next size
'*WimpSlot -min 64K' would allow the program to use 64Kilobites or more for it's work space.

Please post any replys here or e-mail me at;

&lt;A HREF="MailTo:MarkAgius@Aol.Com"&gt;MarkAgius@Aol.Com&lt;/A&gt;.

Find Out Trhe Amount Of Memory Being Used By A Program?
How can I find out how much memory and processing power is being used by a program?

How Can I Monitor Memory Usage By My Program In WInXP???
Hello every1,
I'm on WinXP with VB 6. I'm making some programs with lots of variables in it. I wanna know how much memory my program variables r taking. Is there a utility in WINXP which may help me to get the required data. I wanna know a quick reply..

Getting The Addresses/values Of All Memory Locations That A Program Uses
Sorry, I don't even know how to word what i want to do 'technically correct'.

Programs use memory to store values and variables right?

Good. So there is this program that I use, and I would like to retreive the value of a variable in the program (that you can change via the console of the game/program).

However, I'm not sure how to go about reading ALL the locations/values of memory that only this program uses. If I could figure out how to read ALL of them, I could figure out which one is the value that i'm changing, and how to look specifically at that memory address.

Also, will the address of the memory that this variable uses change during different initiations of the program or will it always be constant?

I hope i've made clear what Id like to do :

I was searching for an API functino to do what I want to do, and I did find ReadProcessMemory ... but i'm not sure how to use it to do what i want to do. I don't know how to get the values to read from...etc.


Launching Program On USB Memory Drive Insertion
This one could be tricky.

I recently got one of those shiny, new USB memory drive things and I'm wondering what exactly I can do with it. Then, I got an idea, but I need help putting it together.

Whenever I insert the USB drive in a computer, I would like to have a program that I coded in VB6 and located ON the drive launch itself. Ideally, the thing would be completely independant and not rely on anything else to start. However, a solution using a small program already present and running on the computer itself to detect the device and start the main application could work, too.

Also, is there a way to find out which letter drive the USB device was assigned to? (for example, is it E:, or F:, ...)

I Need Help Making A Small Memory Manager Program...
I'm having a lot of trouble with this. Pretty much I have to input 5 processes with different sizes(user defined at run time) into an array. The processes must be able to be added or removed. I have to implement the First fit algorithm so that if a process is removed, it leaves a hole in "memory", so if a new process is added, and its smaller or equal size to that hole, it will be input into it. I also have to implement a Compaction button, so if there is a hole in memory, it will compact all of the processes so that there are no more holes.

I've asked my professor to help me after class but she says she never has time(I hate her). I've tried several VB help sites but I cant get any help with this at all. I'm already stuck trying to make an array, and I'm running into an error. The error occurs at run-time when I click the Add Process 1 button(command1_click). The error says "run-time error 424, object required" and it highlights "PIDnum1 = val(textbox1.text)"

vb Code:
Dim PIDnumarray(4) As StringDim PIDsizearray(4) As String Private Sub Command1_Click()PIDnumarray(0) = PIDnum1PIDsizearray(0) = PIDsize1 PIDnum1 = Val(textbox1.Text)PIDsize1 = Val(textbox2.Text)End Sub Private Sub Form_Load()Dim PIDnum1, PIDnum2, PIDnum3, PIDnum4, PIDnum5 As ByteDim PIDsize1, PIDsize2, PIDsize3, PIDsize4, PIDsize5 As Integer End Sub

Any help you can give me or any tips you can give me to get started will help me. I really think its unfair that my professor isn't even available to help me out with this. Thanks for reading.

Program Eating Up Memory..LAGGG(winsock)
Timer4.Enabled = True
rpm = "0"
List1.ListIndex = 0
List2.ListIndex = 0
Dim e, d As String
pnum = "0"

Open Text7.Text For Input As #9

For i = 1 To Text3.Text
Load Winsock2(i)
Load Timer2(i)
Timer2(i).Interval = Text4.Text & "000"
Timer2(i).Enabled = True
e = getproxy
Winsock2(i).Connect Left(e, InStr(1, e, ":") - 1), Mid(e, InStr(1, e, ":") + 1, Len(e))
Next i

My friend mentioned something to me about creating a control array to reduce lag? I thought thats what I already had.. it scans proxy for the ability to send data to a certain website of mine for testing and if I use more than 100 sockets I get extreme lag and eating up half my cpu while i have 2gigs of ram!! how is this possible what's going on

Program Stays In Memory After I Close It..?[SOLved]
i have my program, it has a splash screen.
and then i got the program, after i close that form, the program remains in memory.
heres the splash screen, (i think that , thats what stays open...right?)

VB Code:
Private Sub Form_KeyPress(KeyAscii As Integer)    frmSplash.Hide    Counter.Show    Unload Me End Sub Private Sub Frame1_Click()    frmSplash.Hide    Counter.Show    Unload MeEnd Sub Private Sub Picture1_Click()frmSplash.HideCounter.ShowUnload MeEnd Sub

well after that, the other form (counter.frm) opens
i click the X on that program to close it, and the program remains in the computers memory!
whats wrong?

Program To Find Out How Much Memory Each Object (variable) Uses
What program can I use to find out how much memory my program is taking... specifically how much each form is taking?

If there is a program that could break it down (like Form1 is taking up 3MB, Command1 is taking 2K, myVariable is taking 12K... etc.) that would be excellent.

My program has about 12 forms and uses a few components... but when it is run it drops my system resources like 20% (I have 128 MB Ram)... is this normal?

Copyright © 2005-08, All rights reserved