Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic CreateGraphics issue (Read 3461 times)
Julien_Dechene
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Jun 20th, 2011
CreateGraphics issue
Sep 8th, 2011 at 5:22pm
Print Post  
Hello, I would like to know if there is any known issues regarding Graphics objects not being disposed properly. I get regular errors (about once a week with 40-50 users) concerning System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB() (last line of the callstack). After looking it up on google I found that this was usualy caused by Graphics object not being disposed properly and Windows unable to create any more handles. We don't create any Graphics objects in the code on our side and I saw several places where CreateGraphics was called in your library. I was wondering if, to your knowledge, there is any known issues concerning this kind of problems.

Thanks in advance,

Julien D
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateGraphics issue
Reply #1 - Sep 8th, 2011 at 5:45pm
Print Post  
Hi,

What version of the control are you using? The last time I heard of such issues was 4-5 years ago.

What else is there in the callstack with CreateCompatibleDIB on the top? I think GDI resources are counted together (and the total limit is 10000), so you will get the error not only if Graphics instances are not disposed, but also ones such as Bitmaps and Brushes. If CreateCompatibleDIB is called so often that you are always getting the error from it, maybe that bitmap isn't getting disposed...

Stoyan
  
Back to top
 
IP Logged
 
Julien_Dechene
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Jun 20th, 2011
Re: CreateGraphics issue
Reply #2 - Sep 8th, 2011 at 5:59pm
Print Post  
Hello,

We are using the 5.6.1.25501 version of Flowchart.NET and here is the full callstack (it's really not explicit) :

<Entry address="1660824369" function="System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB" module="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" repeatCount="0" functionOffset="289" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="true" displayInCallstack="true" />
<Entry address="1660823524" function="System.Drawing.BufferedGraphicsContext.CreateBuffer" module="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" repeatCount="0" functionOffset="132" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="true" displayInCallstack="true" />
<Entry address="1660823209" function="System.Drawing.BufferedGraphicsContext.AllocBuffer" module="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" repeatCount="0" functionOffset="201" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="true" displayInCallstack="true" />
<Entry address="1660807341" function="System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager" module="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" repeatCount="0" functionOffset="13" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="true" displayInCallstack="true" />
<Entry address="1660822841" function="System.Drawing.BufferedGraphicsContext.Allocate" module="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" repeatCount="0" functionOffset="9" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="true" displayInCallstack="true" />
<Entry address="1635094719" function="System.Windows.Forms.Control.WmPaint" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="199" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="93323556" function="System.Windows.Forms.Control.WndProc" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="884" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="93322746" function="System.Windows.Forms.ScrollableControl.WndProc" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="58" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="93322723" function="System.Windows.Forms.ContainerControl.WndProc" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="19" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="93322720" function="System.Windows.Forms.Control+ControlNativeWindow.OnMessage" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="0" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="93322878" function="System.Windows.Forms.Control+ControlNativeWindow.WndProc" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="142" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />
<Entry address="1635104589" function="System.Windows.Forms.NativeWindow.Callback" module="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" repeatCount="0" functionOffset="37" sourceFileName="" sourceFileLine="0" lastTouchChangelist="0" includeInMd5="false" displayInCallstack="true" />

And here's the message we get :

System.ComponentModel.Win32Exception: Not enough storage is available to process this command

You are saying that the crash might be caused by Brushes or Bitmaps not being disposed properly ? I will investigate that, thans a lot for the info it is much apprecitated as always.
  
Back to top
 
IP Logged
 
Julien_Dechene
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Jun 20th, 2011
Re: CreateGraphics issue
Reply #3 - Sep 8th, 2011 at 6:49pm
Print Post  
Could it be also caused by MindFusion.Drawing.Pen objects not being disposed properly ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateGraphics issue
Reply #4 - Sep 8th, 2011 at 7:22pm
Print Post  
I think one of the main purposes (apart from serialization) of MindFusion.Drawing.Pens is to avoid having to call Dispose on them. This lets you set them as property values of items without having to keep track if they are still used. Only the System.Drawing.Pens created from the MindFusion.Drawing ones (e.g. when item.Draw runs) must be disposed.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateGraphics issue
Reply #5 - Sep 8th, 2011 at 7:41pm
Print Post  
The callstack mentions a ScrollableControl. Does the error happen when scrolling the content of some control, and which one? I don't think DiagramView derives from ScrollableControl, but ShapeListBox might do that through ListBox.
  
Back to top
 
IP Logged
 
Julien_Dechene
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Jun 20th, 2011
Re: CreateGraphics issue
Reply #6 - Sep 8th, 2011 at 7:57pm
Print Post  
Meh !!! Found out my problem (at least I hope so ), Brushes were created and not disposed in the DrawHandles of my class inheriting DiagramNode. Your replies were more than usefull to find out what was wrong im my code and for that sir I salute you ! Grin
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint