buildTensorflow
buildTensorflow copied to clipboard
Memory Leaks in creating Tensors and Ops
Lot of times we are constructing objects on the heap and not explicitly deleting them. This leads to a ton of memory leaks. We need to debug this and solve it. One way is to manually keep a check of these pointers. Another way is to use smart pointers and let memory leaks be handled that way.
We have two options to handle memory leaks:
- We remove all dependencies, all tensors and operations by using a DFS like call when the destructor of a Tensor is called.
- Or we use smart pointers and let C++ handle memory safety.
As pointers are shared cyclically, we will need to use a combination of shared and weak pointers.
Any thoughts on how to handle memory leaks @uditarora ?