G30 PWM stopping without calling stop

I’m using the G30 and the PWM pin stops when the code is still running and the stop method is not called. So far this seems to be something to with load on the serial port but I haven’t yet narrowed it down any further.

I bet you lost the reference and the garbage collector cleared it.

That was what I was thinking but the reference is an instance variable and should not be being garbage collected at all. The containing class still exists because the main loop is running in it. It is behaving like the GC is under memory pressure and gets forced to get rid of something that hasn’t been accessed in a while even if the reference should still be intact.