Memory Leak (oh boy what fun)

I run a task on the Part Form and everytime I run it, it doesn’t dispose of all of these EpiForm/EpiTransactions when it’s done. I have found a way to cache the PartForm. Is there a way to cache or dispose these other forms? I’ve already went through the vb.net and disposed of all adapters after using them.

image

Everytime I run the process the memory used goes up by 1/4 gigabyte and it never releases the memory (just keeps building)

related topics:

It would depend on what’s in your code. The Disposing section should be used to clear objects.

2 Likes

Are you referring to this part:

Public Sub DestroyCustomCode()
	' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	' Begin Wizard Added Object Disposal

	RemoveHandler Me.cboClassGrpCode.ValueChanged, AddressOf Me.cboClassGrpCode_ValueChanged
	RemoveHandler Me.txtDrawRev.KeyPress, AddressOf Me.txtDrawRev_KeyPress
	RemoveHandler Me.txtCategory.KeyPress, AddressOf Me.txtCategory_KeyPress
	RemoveHandler Me.txtSubCat.KeyPress, AddressOf Me.txtSubCat_KeyPress
	RemoveHandler Me.txtCreatorID.KeyPress, AddressOf Me.txtCreatorID_KeyPress
	RemoveHandler Me.PartForm.Closing, AddressOf Me.PartForm_Closing
	' End Wizard Added Object Disposal

	' Begin Custom Code Disposal

    If (newSession IsNot Nothing) Then
        Dim sMod As Ice.Proxy.Lib.SessionModImpl = TryCast(GetInstanceField(GetType(Ice.Core.Session), newSession, "sessionMod"), Ice.Proxy.Lib.SessionModImpl)
        sMod.Logout()
        Me.newSession = Nothing
        Me.iLnch = Nothing
        Me.newTransaction = Nothing
    End If

	' End Custom Code Disposal
End Sub

You should switch to C# VB.net will not be supported much longer
Also why are you closing the session?

When you close the Part Screen does it keep all to these open?
It is fine to have those loaded as long as the PartScreen itself is still open.

Yes, but that “newSession” code is VERY unique.

As for what should be in there, I would expect that if you have any Class Level variables, those would need to be destroyed.

Lastly, unless you are using Vantage 8 or lower, you would be best served converting to C#.

2 Likes

Okay I hate vb.net anyway not sure why anyone decided to write the first few customization’s in it. This transaction is not being disposed of or released when my customization finishes running…

image

You’ll have to carefully look through the code? are there any objects or adapters instantiated in a loop and not disposed? etc
Unfortunately there’s a lot that can go on, hard to tell without looking at the code and even then…

1 Like

Thank you… I will have to keep trying until i figure out how to dispose it. I’ll keep this post updated with findings