[GRASS-dev] [GRASS GIS] #837: Memory leaks in r.example

GRASS GIS trac at osgeo.org
Tue Dec 15 15:35:09 EST 2009


#837: Memory leaks in r.example
-------------------------+--------------------------------------------------
 Reporter:  sprice       |       Owner:  grass-dev at lists.osgeo.org
     Type:  defect       |      Status:  new                      
 Priority:  normal       |   Milestone:  6.4.0                    
Component:  default      |     Version:  svn-releasebranch64      
 Keywords:               |    Platform:  MacOSX                   
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------
 In r.example, there are many small memory leaks in basic functions. Not
 only is it bad to have this many leaks in the example module, the leaks
 probably persist through many other modules. Here is the location of leaks
 in a run of r.example, altered only to print "Done!" & pause before exit.

 It seems to mostly be a single leak in find_file(), but there is another
 leak in G_gisinit().

 (in text GRASS)
 {{{
 GRASS 6.4.0svn (semisup):~ > r.example --o input=landcover
 output=landcover.test
 r.example(18500) malloc: protecting edges
 r.example(18500) malloc: recording malloc stacks to disk using standard
 recorder
 r.example(18500) malloc: enabling scribbling to detect mods to free blocks
 r.example(18500) malloc: stack logs being written into /tmp/stack-
 logs.18500.r.example.TQfsBA.index
 Done!
 ^C
 sh(18567) malloc: protecting edges
 sh(18567) malloc: recording malloc stacks to disk using standard recorder
 sh(18567) malloc: enabling scribbling to detect mods to free blocks
 sh(18567) malloc: process 18500 no longer exists, stack logs deleted from
 /tmp/stack-logs.18500.r.example.TQfsBA.index
 sh(18567) malloc: stack logs being written into /tmp/stack-
 logs.18567.sh.JvnnBY.index
 g.gisenv(18568) malloc: protecting edges
 g.gisenv(18568) malloc: recording malloc stacks to disk using standard
 recorder
 g.gisenv(18568) malloc: enabling scribbling to detect mods to free blocks
 g.gisenv(18568) malloc: stack logs being written into /tmp/stack-
 logs.18568.g.gisenv.yqOvWQ.index
 g.gisenv(18568) malloc: stack logs deleted from /tmp/stack-
 logs.18568.g.gisenv.yqOvWQ.index
 g.gisenv(18570) malloc: protecting edges
 g.gisenv(18570) malloc: recording malloc stacks to disk using standard
 recorder
 g.gisenv(18570) malloc: enabling scribbling to detect mods to free blocks
 g.gisenv(18570) malloc: stack logs being written into /tmp/stack-
 logs.18570.g.gisenv.5s2NuI.index
 g.gisenv(18570) malloc: stack logs deleted from /tmp/stack-
 logs.18570.g.gisenv.5s2NuI.index
 g.gisenv(18571) malloc: protecting edges
 g.gisenv(18571) malloc: recording malloc stacks to disk using standard
 recorder
 g.gisenv(18571) malloc: enabling scribbling to detect mods to free blocks
 g.gisenv(18571) malloc: stack logs being written into /tmp/stack-
 logs.18571.g.gisenv.6FNlZi.index
 g.gisenv(18571) malloc: stack logs deleted from /tmp/stack-
 logs.18571.g.gisenv.6FNlZi.index
 sh(18567) malloc: stack logs deleted from /tmp/stack-
 logs.18567.sh.JvnnBY.index
 GRASS 6.4.0svn (semisup):~ >
 }}}

 (outside of GRASS)
 {{{
 seth:r.example sprice$ leaks r.example
 Process 18500: 1701 nodes malloced for 466 KB
 Process 18500: 1622 leaks for 25968 total leaked bytes.
 Leak: 0x100100040  size=32  zone: DefaultMallocZone_0x100083000 string
 '/Users/sprice/grass/semisup'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G__gisinit | G_location_path | G__location_path | G__malloc | malloc |
 malloc_zone_malloc
 Leak: 0x100100380  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x1001003c0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G_raster_map_type | find_file | G_store | G__malloc | malloc |
 malloc_zone_malloc
 Leak: 0x1001003d0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G_open_cell_old | G__open_cell_old | find_file | G_store | G__malloc |
 malloc | malloc_zone_malloc
 Leak: 0x1001003e0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G_open_cell_old | G__open_cell_old | G_raster_map_type | find_file |
 G_store | G__malloc | malloc | malloc_zone_malloc
 Leak: 0x1001003f0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G_open_cell_old | G__open_cell_old | G_get_gdal_link | find_file | G_store
 | G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100100400  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 G_open_cell_old | G__open_cell_old | G_get_gdal_link | G_raster_map_type |
 find_file | G_store | G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100100480  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100100490  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100100510  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100100520  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 [...]
 Leak: 0x100106ba0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100106bb0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100106bc0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 get_map_row | get_null_value_row | find_file1 | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x1001076e0  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 close_new | G_write_range | G_raster_map_type | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 Leak: 0x100107830  size=16  zone: DefaultMallocZone_0x100083000 string
 'sprice'
         Call stack: [thread 0x7fff70224be0]: | 0x4 | start | main |
 close_new | G__write_cats | G_raster_map_is_fp | find_file | G_store |
 G__malloc | malloc | malloc_zone_malloc
 seth:r.example sprice$
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/837>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list