On Tue, Oct 2, 2012 at 5:55 AM, jody <[email protected]> wrote: > > > --------------------------------- > void CellGrid::destroyGrid() { > > if (m_apCells != NULL) { > for (coord j = 0; j < m_iNumCells; j++) { > if (m_apCells[j] != NULL) { > delete m_apCells[j]; > } > } > delete[] m_apCells; > } > > //.... other stuff unrelated to m_apCells > }
This is not related to your problem, but... In C++ -- all versions ever, standard or otherwise -- calling "delete" on a NULL pointer is guaranteed to be a no-op. So there is never a need to check for NULL before calling "delete". Doing so makes your code run slower, makes it harder to read, and makes the reader wonder whether the author simply does not know C++ or is trying to work around some obscure bug in some compiler. - Pat ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
