Induced garbage collection

I keep on running into a random bug, and after rebooted my mac and it didn’t happen, I’m thinking garbage collection hasn’t happened.
How do I induce it?

What do you mean by “garbage collection” here? If you mean that objects that are no longer in scope have yet to be cleaned up, that’s now Xojo works. It uses reference counting so as soon as that count drops to zero, the object is gone.

Yes. I understand XOJO does reference counting. It’s just every time I account for things (step in) that could be buggy, they aren’t. Then when I don’t trace they get buggy, and I don’t know where else to look.
Any other suggestions?

[quote=397534:@Arthur Gabhart]It’s just every time I account for things (step in) that could be buggy, they aren’t. Then when I don’t trace they get buggy, and I don’t know where else to look.
Any other suggestions?[/quote]
That sounds like a race condition to me. When you pause and step in the app gets time for some things (not all) to catch up.

This is where logging might be more useful than stepping.

Tim, Exactly what I was thinking. Did not have name. So what can I do?
I have never done logging.

Use System.DebugLog. It should record the messages in the Log pane at the bottom of the IDE. Or use DebugView on Windows or whatever the equivalent is on that other OS.

I will go looking for other posts about the debuglog after posting this. Probably tomorrow morning.
How do I set this up. I have this “If” statement that apparently sets 2 booleans.

If DteDet > ThPrefsF.ModificationDate Then App.PFFirst = True App.RnChgPf = True //the ignored boolean End If//If DteDet > ThPrefsF.ModificationDate Then

The If statement is in the close event for a window, so I know the event happens.
Then because of these booleans being set, the Preferences Window opens.
The 2 boolean should cause the preferences to reload. I know they aren’t because they are opened to the default and the preferences file is not loaded.

The method in the Preferences Window which the problem statement is in, runs but ignores this piece.
The statement set that doesn’t get run is this:

If IniHerd.DiffColl = True Or App.RnChgPf = True Then //the boolean was set in the previous window App.OpenPrefs(). //the method which isn't run ReDim FldDTitles(-1) ReDim FldFTitles(-1) ReDim FldPTitles(-1) FldTtleListBox.DeleteAllRows SorceList.DeleteAllRows RplcingBox.DeleteAllRows GetADWrdBox.DeleteAllRows End If

CurrentMethodName is your friend. Here is a random example from my code:

[code]if not CkoMailTask.TaskSuccess then
Globals.theErrorLog.LogItem(CurrentMethodName + " " + MailboxPath + " task didn’t finish")
Return “”
end if

dim theBody as String = CkoMailTask.GetResultString
if theBody = “” and not Globals.StopArchiving then
globals.theErrorLog.LogItem(CurrentMethodName + " " + MailboxPath + " wasn’t able to load result from task")
globals.theErrorLog.LogItem(CurrentMethodName + " " + MailboxPath + setLastErrorForTask(CkoMailTask))
end if[/code]

theErrorLog is a simple TextOutputstream. If you want to trace strange ways of executing your code use something like

[code]Globals.theErrorLog.logitem currentMethodName, “open”

'your code here

Globals.theErrorLog.logitem currentMethodName + " done", “close”[/code]

in methods that you suspect of misbehaving. This isn’t elegant but very very useful.