humangeo / leaflet-dvf

Leaflet Data Visualization Framework
MIT License
689 stars 153 forks source link

Question: About clean up of preProcess and postProcess in LinearFunction? #87

Open rickj33 opened 8 years ago

rickj33 commented 8 years ago

I have implemented a custom color function derived from L.PiecewiseFunction, similar to the L.CustomColorFunction, In my implementation I implemented a destroy() method to handle cleaning up some references. As I started going though the code, I noticed that the pre and post Process variables are never set to null. If I set those variables by using functions on another object, when gc ran I am assuming it would not be able to release the the object which provided the functions to use.

I could be wrong, but wanted to ask

Thanks

sfairgrieve commented 8 years ago

Good point. I'm not sure of the answer off hand, but adding cleanup code seems like a good idea. I'll do some more research, though. In general I've been bad at worrying about JS GC, but perhaps I need to think about it more.