buildTensorflow icon indicating copy to clipboard operation
buildTensorflow copied to clipboard

Memory Leaks in creating Tensors and Ops

Open karanchahal opened this issue 7 years ago • 1 comments

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.

karanchahal avatar Mar 15 '19 08:03 karanchahal

We have two options to handle memory leaks:

  1. We remove all dependencies, all tensors and operations by using a DFS like call when the destructor of a Tensor is called.
  2. 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 ?

karanchahal avatar Apr 08 '19 08:04 karanchahal