POV-Ray : Newsgroups : povray.off-topic : Smart little programming tricks, where to find ? : Re: Smart little programming tricks, where to find ? Server Time
11 Oct 2024 01:24:44 EDT (-0400)
  Re: Smart little programming tricks, where to find ?  
From: stbenge
Date: 19 Mar 2008 18:52:53
Message: <47e1a755$1@news.povray.org>
Say I wrote

int** foo = NULL;
int nx = 22, ny = 17;

void matrixfunc(){
  foo = new int*[nx];

  for (int x = 0; x < nx; x++)
   foo[x] = new int[ny];
}


and called matrixfunc();, but before I could delete it

for (int x = 0; x < nx; x++)
  delete[] foo[x];

  delete[] foo;
  foo = NULL;

the code crashed. Do I have a memory leak?

Sam


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.