Hello,
i got a problem deleting a former in a class constructor created array in the corresponding destructor (see code below). There is a runtime error which insits that the program was trying to free memory twice, without explicitly deleting the array all works fine, but im not sure if this is the right way.

Code:
class allocator{
  double* array;
  allocator(arraysize): array(new double[arraysize]){
  }
  
  //is not working as it is supposed to do, thus not used
  /*
   * ~allocator(){ delete [] array;
   *                 }
   */
}

int main(){
  allocator a1(5);
}