|
-
February 23rd, 2000, 10:08 AM
#1
Out Of Memory
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.
-
February 23rd, 2000, 10:27 AM
#2
Re: Out Of Memory
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.
-
February 23rd, 2000, 12:27 PM
#3
Re: Out Of Memory
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.
-
February 23rd, 2000, 12:46 PM
#4
Re: Out Of Memory
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
-
February 23rd, 2000, 03:45 PM
#5
-
February 23rd, 2000, 06:52 PM
#6
Re: Out Of Memory
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
-
February 23rd, 2000, 07:26 PM
#7
Re: Out Of Memory
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.
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
|