I have been battling with a memory leak that causes my desktop application to crash from time to time - usually when changing from one window to another in OSX.
I have stopped using self.close in windows and using self.hide instead. That seems to have helped.
Is there a definitive write-up on best practice? If not, I would appreciate any helpful comments forum members feel worth sharing.
Topics might include when and where to close database access, better solutions to closing windows…
i have a debug menu , i open a window with listbox and label and show some useful info.
have a look at WeakAddressOf and WeakRef.
if this data looks good than perhaps the leak is somewhere else.
Sub Open() Handles Open
Listbox1.RemoveAllRows
Var lastObjectIndex As Integer = Runtime.ObjectCount - 1
Var objectRefs As Integer = 0
For i As Integer = 0 To lastObjectIndex
Listbox1.AddRow(Runtime.ObjectID(i).ToString)
Listbox1.CellValueAt(ListBox1.LastAddedRowIndex, 1) = Runtime.ObjectClass(i)
Listbox1.CellValueAt(ListBox1.LastAddedRowIndex, 2) = Runtime.ObjectRefs(i).ToString
objectRefs = objectRefs + Runtime.ObjectRefs(i)
Next
Label1.Value = Str(Runtime.MemoryUsed)+ " bytes total amount of memory used by the allocated objects " +objectRefs.ToString
End Sub