Of course.
When I wrote that comment I asked myself should I have written "malloc" or "malloc/free" - surely one implies the other.
When I wrote that comment I asked myself should I have written "malloc" or "malloc/free" - surely one implies the other.
Of course, you need to be careful as if you write code like that in a language without garbage collection, it's inherently not reuseable - retrofitting deallocation is often really painful because it gets easy to adopt patterns that make object ownership etc. unclear when you don't have to ensure it's easy to deallocate in the right order.