Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42492

VS 2010 Memory leak caused by drawing?

$
0
0
I'm observing a memory leak in my project and I do believe it is caused by the way I'm drawing.

My present usage was:
Code:

Private Sub MyPictureBox_Paint(ByVal sender As Object, ByVal e As System.Windows.forms.PaintEventArgs) Handles MyPictureBox.Paint
PictureBox_DoPaint(e.Graphics)
End Sub

Private Sub PictureBox_DoPaint(ByVal g As Graphics)
'some Paintings
Lines_DoPaint(g, MyPen, Lines)
End Sub

Private Sub Lines_DoPaint(ByVal g As Graphics, ByVal MyPen as Pen, ByVal Lines() as PointF )
g.DrawLine(MyPen,(g, MyPen, Lines)
End Sub

Using the Subs like that, the memory usage is steadily increasing.
When changing the Subs "PictureBox_DoPaint" and "Lines_DoPaint" the have only ByRef arguments, the memory usage seems to be steady.
Was this (one of) the reason(s) for my memory leak?

Viewing all articles
Browse latest Browse all 42492

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>