I usually use this if I'm doing a series of complex code inside a loop like this:
dim iCount as integer =0
For each Widget in MyWidgets
iCount = iCount + 1
If (iCount Mod 100 = 0) Then
'..... do loads of complex stuff and functions here on my "Widget" object
This should free up some memory, other than that go through your code and see if you can be more efficient when it comes to memory use.