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:
Using the Subs like that, the memory usage is steadily increasing.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
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?




Reply With Quote