back

by moultano·16y ago·view on hn ↗
The C++ closure library we use internally at Google has you specify whether the callback is permanent or not. If it isn't permanent, its deleted right after executing. It is a little painful maintaining the memory of your arguments, but people have generally converged to packing them all into a heap allocated struct and deleting when appropriate.