473,806 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Intermittent 'Out of memory' error

I have a VB .NET windows application that is throwing an intermittent
'out of memory' error. Here is the call stack.

Out of memory.

at System.Drawing. Graphics.FromHd cInternal(IntPt r hdc)
at System.Windows. Forms.DibGraphi csBufferManager .CreateBuffer(I ntPtr
src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
at
System.Windows. Forms.DibGraphi csBufferManager .AllocBuffer(Gr aphics
targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at System.Windows. Forms.DibGraphi csBufferManager .AllocBuffer(In tPtr
target, Rectangle targetBounds)
at System.Windows. Forms.Control.W mPaint(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam) Source = System.Drawing

The program uses our own timer form that gives a countdown between each
processing cycle. Each processing cycle looks for reports that need
running from 3 SQL Server 2000 databases (don't ask why there are
three). Also, once a day it does a bcp load of data into each of the 3
database and runs various snapshot tasks.

I don't think the details are important besides to say it is doing a
fair amount of processing.

The question is, is this likely to be caused by memory leakage. Sounds
like it to me but I thought that I'd find out if anybody else gets this
error. The call stack is always the same but it fails at various times
of day but sometimes not for 2 weeks.

I have been monitoring the memory usage and it does go up gradually
over time from 120Mb to 150Mb. I have added garbage collection calls to
no effect.

The program uses COM in various places.

Any advice greatly appreciated.

Jul 18 '06 #1
2 2301
Liverpool fan,

Have a look about all that is written about dispose on MSDN to clean up your
not managed resources.

http://msdn.microsoft.com/library/de...posemethod.asp

http://msdn.microsoft.com/library/de...izeDispose.asp

Using the dispose methods implemented in the managed classes will probably
not help you as well as calling the gc for the same,

I hope this helps,

Cor
"Liverpool fan" <ch*********@fe ltex.comschreef in bericht
news:11******** *************@m 73g2000cwd.goog legroups.com...
>I have a VB .NET windows application that is throwing an intermittent
'out of memory' error. Here is the call stack.

Out of memory.

at System.Drawing. Graphics.FromHd cInternal(IntPt r hdc)
at System.Windows. Forms.DibGraphi csBufferManager .CreateBuffer(I ntPtr
src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
at
System.Windows. Forms.DibGraphi csBufferManager .AllocBuffer(Gr aphics
targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at System.Windows. Forms.DibGraphi csBufferManager .AllocBuffer(In tPtr
target, Rectangle targetBounds)
at System.Windows. Forms.Control.W mPaint(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam) Source = System.Drawing

The program uses our own timer form that gives a countdown between each
processing cycle. Each processing cycle looks for reports that need
running from 3 SQL Server 2000 databases (don't ask why there are
three). Also, once a day it does a bcp load of data into each of the 3
database and runs various snapshot tasks.

I don't think the details are important besides to say it is doing a
fair amount of processing.

The question is, is this likely to be caused by memory leakage. Sounds
like it to me but I thought that I'd find out if anybody else gets this
error. The call stack is always the same but it fails at various times
of day but sometimes not for 2 weeks.

I have been monitoring the memory usage and it does go up gradually
over time from 120Mb to 150Mb. I have added garbage collection calls to
no effect.

The program uses COM in various places.

Any advice greatly appreciated.

Jul 18 '06 #2
Thanks for replying Cor. I has already tried enforcing a Garbage
Collection which seemed to help to an extent but only to decrease the
frequency of the error. I'll have a look at the articles and compare to
what I am doing already as far as COM is concerned.

Here is the Timer calling routine. I have changed it slightly in that
instead of creating a new timer dialog for each loop, I reuse the
previous one. This seems to have helped immensely but I now have a 4K
creeping of memory usage for each loop (when nothing is executed).

Private Sub StartTimer()

Dim dtloadfull, dtjobscan As Date
Dim sLoadFull As String = "Load Sales Extract"
Dim sprocessjobs As String = "Process Job Queue"

Me.ListBox1.Ite ms.Add("Started " & Date.Now.ToStri ng)
Me.ListBox1.Sel ectedIndex = Me.ListBox1.Ite ms.Count - 1

' next order scan
dtjobscan = DateAdd(DateInt erval.Minute, myJobScanInterv al,
Now)

' launch the timer
f = New dlgZTimer
f.TimerInterval Secs = 1

Do
'Clean up memory
GC.Collect

' get time of next full update. may be next day.
If myFullLoadTime = "" Then
dtloadfull = Nothing
Else
dtloadfull =
System.Convert. ToDateTime(Now. ToShortDateStri ng & " " & myFullLoadTime)
Do While dtloadfull < Now
dtloadfull = DateAdd(DateInt erval.Day, 1,
dtloadfull)
Loop
Me.lblProgress. Text = "Progress (" & "Next full
extract load at " & dtloadfull.ToSt ring & ")"
Application.DoE vents()
End If

' next order scan
dtjobscan = DateAdd(DateInt erval.Minute, myJobScanInterv al,
Now)

f.TimerTitle = ""

If myFullLoadTime = "" Then
f.TimerTitle = sprocessjobs
f.TargetTime = dtjobscan
Else
' if full load is in the next 10 minutes, wait for it
If dtloadfull <= DateAdd(DateInt erval.Minute, 10, Now)
Then
f.TimerTitle = sLoadFull
f.TargetTime = dtloadfull
Else
' no trans available, check for orders
f.TimerTitle = sprocessjobs
f.TargetTime = dtjobscan
End If
End If

If f.TimerTitle <"" Then

If f.ShowDialog(Me ) = DialogResult.OK Then
If f.TimerTitle = sprocessjobs Then

If myMultiThreaded = True Then
ProcessJobQueue MultiThreaded()
Else
ProcessJobQueue ()
End If
' test for network connection
If myLastNetworkCh eck < Now.AddHours(-1) Then
Try
DisplayHistory( "******** Testing
network connection")
Dim str As String()
str =
System.IO.Direc tory.GetFiles(m yBCP_Full_Direc tory)
myLastNetworkCh eck = Now
Catch ex As Exception
DisplayErrorInL ist(ex)
End Try
End If

End If

If f.TimerTitle = sLoadFull Then
ProcessEOD()

' test to see if EOD data has been loaded
CheckEODStatus( )
End If
Else
' Cancelled
f.Dispose()
f = Nothing
Exit Sub
End If
End If
Loop

End Sub

I have focussed on this because of the rate that the memory was being
used up even when the program wasn't doing anything but running the
timer. Seemed to be a prime candidate.

Any thoughts greatly appreciated.

Jul 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1053
by: Bill Burwell | last post by:
Which memory properties, or what combinations of memory properties, provide useful information about a program's memory usage when that program has just started leaking memory? While I have a VB bias, it seems to me the answer to this question should be generic - that is language independent.
1
2027
by: bloodhound | last post by:
Hi, Problem with global.asa not firing 100% of the time. This error crops up several times throughout the day but if you wait a while and reload the page (could be 5 mins or an hour) it will suddenly start working again. The error is: ADODB.Recordset error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in
0
292
by: deevoy | last post by:
Hi- I'm developing a asp.net web application and everything has proven fine on the dev and acceptance environment. We've moved the code up to our windows server 2003 prod environment and get the following intermittent error when browsing the web page through a client browser (the action causing this is paging though a datagrid- although it randomly errors, rather than erroring all the time): ________________ Invalid character in a...
3
2046
by: Lee Chapman | last post by:
Hi, I have a problem where my ASP.NET application occasionally generates a MissingFieldException exception. This unexpectedly happened on my development box, and so I was able to extract some information from the debugger: The field that is "missing" is called 'logger'. Here's it's description taken from ildasm.exe: ..field public static class log4net.ILog logger
1
1228
by: deevoy | last post by:
Hi- I'm developing a asp.net web application and everything has proven fine on the dev and acceptance environment. We've moved the code up to our windows server 2003 prod environment and get the following intermittent error when browsing the web page through a client browser (the action causing this is paging though a datagrid- although it randomly errors, rather than erroring all the time):
9
2673
by: Tim_Mac | last post by:
hi, i'm not sure if i have chosen the best approach, but it seemed quite good to me. i have a collection class, containing business objects. the collection class is static and remains in-memory all the time the app is running. it is persisted to an Xml file when necessary. i keep a static filestream on the xml file. the advantage of this is that i can lock the filestream object to prevent concurrent reading/writing. the code works...
8
1867
by: Dave | last post by:
I am getting an intermittent database error on my asp page. I am using Access 2003 with classic ASP. The error is this: Microsoft JET Database Engine Error 80040e10 No value given for one or more required parameters /subweb/search.asp, line 163 Line 163 is starred below:
4
1473
by: steve_barker333 | last post by:
Hi guys! I keep getting the following error reported by VS 2005 in my ASP.NET 2.0 web project: "The type or namespace name 'MainPages_XXX' could not be found (are you missing a using directive or an assembly reference?)" The line of C# code (in the "code-behind" file) that error refers to looks something like this:
0
1215
by: Joey Bersche | last post by:
I've been experiencing an intermittent crash where no python stacktrace is provided. It happens for a url downloading process that can last up to 12 hours and crawls about 50,000 urls. I'm using urllib2 for the downloads. There are 5-10 downloading threads, and some custom website exploration code for providing the urls to crawl. The downloads are completed in memory (not piped), then saved to a file. There are also nice per domain...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10373
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.