I have the following code and was wondering if it is a memory leak

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

template <class T>
class live {
  vector<T> _data;
  live<T> *_next, *_temp;
public:
  live(int elements, int chunk = 10) : _next(NULL)
  {
    if (elements > chunk)
    {
      _data.reserve(chunk);
      _next = new live<T>(elements - chunk, chunk);
    }
    else _data.reserve(chunk);
  }
  
  ~live() { if (_next) { _next->~live(); delete _next; } }

};

Do I have to call the destuctor of the vector because I allocated:
_next = new live<T>(elements - chunk, chunk);
or is it called automatically when it becomes out of scope?

There is no need to call _next->~live(); since it is called when using delete _next; and this will likely cause some problems, as the memory will be freed twice. You do not need to free memory for the vector as it is contained within the class.

So basically this is all that is required?

~live() { if (_next) delete _next; }

for the destuctor?

So basically this is all that is required?

~live() { if (_next) delete _next; }

for the destuctor?

you don't need the 'if' either, if _next is NULL then delete will not create any problems.

This question has already been answered. Start a new discussion instead.