Click to See Complete Forum and Search --> : Out Of Memory
Atlantisoft
February 23rd, 2000, 09:08 AM
Is there a way I can find out if my program tries to do something but the computer doesn't have enough memory? This has happened before but it crashes instead of telling me. Is there a way I can build an error handler for this so the user is notified when they are low on memory? I've been told VB can't check to see how much is left, is that true? Any help would be appretiated, thanx.
Kyle Burns
February 23rd, 2000, 09:27 AM
Possibly using error handling and checking to see if the Object is instantiated would work. I've never thought of that before.
on error resume next
set cn = new ADODB.Connection
If cn is nothing then
'Handle the error
else
'Work with the object
End If
This might be something that the new Try...Catch structure will help us with.
Atlantisoft
February 23rd, 2000, 11:27 AM
I don't see how that answers my question. what does that have to do with memory? What you put would just check if the object can be assigned....that has nothing to do with memory, least not to my knowledge.
Kyle Burns
February 23rd, 2000, 11:46 AM
Not being able to create the object would likely indicate one of two things:
1) The Object is not correctly registered on the client machine
2) The machine was unable to create the Object because there is not enough memory
Atlantisoft
February 23rd, 2000, 02:45 PM
oh ok, cool. thanx
Chris Eastwood
February 23rd, 2000, 05:52 PM
As an aside, I've seen this happen before when a program has got itself stuck in a loop (usually a recursive one, eg. where a paint / resize event calls a routine that in itself, raises a paint / resize event).
A good way to get out of this situation is to use a static variable in the (possible) offending routine :
eg.
private Sub Form_Resize()
static bInHere as Boolean
'
If bInHere then Exit Sub ' quit possible loop
'
bInHere = true
'
' Do some processing
'
' ......
'
bInHere = false
End Sub
- it may help with the out-of-memory error.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Atlantisoft
February 23rd, 2000, 06:26 PM
No, this is simply because I am out of memory. I know I'm out of memory because right before my program crashes, all the other open programs tell me I'm too low on memory to perform the task i wish to perform, etc.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.