Ticket #145 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

Memory leak from LASWriter / lasspatialreference assignment operator=

Reported by: mrosen Owned by: hobu
Priority: minor Milestone: 1.2.1
Component: General Version: 1.2
Keywords: Cc:
LAS Format Version: Not Applicable

Description

The patch below will fix a leak that occurs the first time a LAS Writer flushes its LASHeader. The magnitude of this leak seemed to be about 250Kb (??) per header.

m_tiff and g_tiff (below) are initially assigned during LASSpatialReference::SetGTIF() which is called whenever we call LASWriter_Create()

Without this patch, the first time we call LASWriter_WriteHeader, it calls LASSpatialReference::operator=, which sets these pointers to zero without cleaning up the memory thus causing the memory leak/s.

=======================

diff -r 23b3eb84dbd4 xt_lib_liblas/src/las-1.2/src/lasspatialreference.cpp
--- a/xt_lib_liblas/src/las-1.2/src/lasspatialreference.cpp	Sun Mar 22 18:19:05 2009 -0700
+++ b/xt_lib_liblas/src/las-1.2/src/lasspatialreference.cpp	Mon Aug 24 13:35:35 2009 -0700
@@ -58,8 +58,6 @@
 {
     if (&rhs != this)
     {
-        m_tiff = 0;
-        m_gtiff = 0;        
         SetVLRs(rhs.GetVLRs());
         GetGTIF();
     }

We found this while testing an application that did batch writing of LAS files.

Change History

Changed 7 months ago by hobu

  • priority changed from major to minor
  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.2.1

fixed in r1342 and backported in r1343. Thanks for the report!

Note: See TracTickets for help on using tickets.