bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 59 forks source link

tick() resource leak unless #stop called #264

Open neilconway opened 12 years ago

neilconway commented 12 years ago

If you create a Bud instance, call tick on it, and then neglect to call stop, there is a resource leak. This is because tick adds the Bud instance to the global list of Bud instances, and we only remove the instance from the list on stop.

This could be fixed by calling stop after each tick, but we'd need to restructure the code so that the appropriate state is retained between tick calls (e.g., we don't want to close/truncate persistent tables on every tick).

sriram-srinivasan commented 12 years ago

No, not quite.

The call chain is tick -> start -> do_startup -> init_signal_handling -> register bud instance.

But in start ,the operative line is do_startup unless @bud_started

neilconway commented 12 years ago

Not sure what you mean -- yes, tick effectively does an implicit start if the Bud instance isn't started yet. start without stop leaks resources.

sriram-srinivasan commented 12 years ago

Ah, I see. I interpreted your earlier statement to mean that there is some resource leakage every single time tick is called.