Opened 16 years ago

Closed 16 years ago

#2728 closed defect (fixed)

Minor Memory Leaks

Reported by: aboudreault Owned by: aboudreault
Priority: normal Milestone: 5.4 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: dmorissette

Description

Here is some memory leaks detected during my tests. The map used for these tests is a map that contains a Layer OGR (MapInfo) of type "annotation" with a lot of style.

Valgrind's output:

==5064== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 107 from 1)                                                                            
==5064== malloc/free: in use at exit: 27,667 bytes in 124 blocks.                                                                                    
==5064== malloc/free: 14,999 allocs, 14,878 frees, 2,501,910 bytes allocated.                                                                        
==5064== For counts of detected errors, rerun with: -v                                                                                               
==5064== searching for pointers to 124 not-freed blocks.                                                                                             
==5064== checked 1,702,940 bytes.                                                                                                                    
==5064==                                                                                                                                             
==5064==                                                                                                                                             
==5064== 16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 5                                                       
==5064==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)                                                                                           
==5064==    by 0x458E90C: VSIMalloc (cpl_vsisimple.cpp:300)                                                                                          
==5064==    by 0x457BB09: CPLPushErrorHandler (cpl_error.cpp:678)                                                                                    
==5064==    by 0x4083314: msOGRFileOpen(layer_obj*, char const*) (mapogr.cpp:806)                                                                    
==5064==    by 0x408545A: msOGRLayerOpen (mapogr.cpp:1563)                                                                                           
==5064==    by 0x4085514: msOGRLayerOpenVT(layer_obj*) (mapogr.cpp:1660)                                                                             
==5064==    by 0x408BE41: msLayerOpen (maplayer.c:88)                                                                                                
==5064==    by 0x40A5D7E: msDrawVectorLayer (mapdraw.c:829)                                                                                          
==5064==    by 0x40A6412: msDrawLayer (mapdraw.c:738)                                                                                                
==5064==    by 0x40A7408: msDrawMap (mapdraw.c:441)                                                                                                  
==5064==    by 0x804E430: main (mapserv.c:1434)                                                                                                      
==5064==                                                                                                                                             
==5064==                                                                                                                                             
==5064== 19,331 (1,968 direct, 17,363 indirect) bytes in 41 blocks are definitely lost in loss record 3 of 5                                         
==5064==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)                                                                                           
==5064==    by 0x4055FEC: msyyalloc (maplexer.c:4320)
==5064==    by 0x4056478: msyy_create_buffer (maplexer.c:3859)
==5064==    by 0x405654B: msyyrestart (maplexer.c:3798)
==5064==    by 0x406D42E: msLoadMap (mapfile.c:4652)
==5064==    by 0x804B6BA: loadMap (mapserv.c:203)
==5064==    by 0x804D7DD: main (mapserv.c:1214)
==5064==
==5064==
==5064== 8,320 bytes in 40 blocks are definitely lost in loss record 4 of 5
==5064==    at 0x4021BDE: calloc (vg_replace_malloc.c:397)
==5064==    by 0x4061A0A: msGrowClassStyles (mapfile.c:2096)
==5064==    by 0x4061ADC: msMaybeAllocateStyle (mapfile.c:2125)
==5064==    by 0x4083817: msOGRLayerGetAutoStyle(map_obj*, layer_obj*, class_obj*, int, long) (mapogr.cpp:2160)
==5064==    by 0x408BBFB: msLayerGetAutoStyle (maplayer.c:600)
==5064==    by 0x40A61B8: msDrawVectorLayer (mapdraw.c:894)
==5064==    by 0x40A6412: msDrawLayer (mapdraw.c:738)
==5064==    by 0x40A7408: msDrawMap (mapdraw.c:441)
==5064==    by 0x804E430: main (mapserv.c:1434)
==5064==
==5064== LEAK SUMMARY:
==5064==    definitely lost: 10,296 bytes in 82 blocks.
==5064==    indirectly lost: 17,371 bytes in 42 blocks.
==5064==      possibly lost: 0 bytes in 0 blocks.
==5064==    still reachable: 0 bytes in 0 blocks.
==5064==         suppressed: 0 bytes in 0 blocks.

Attachments (1)

styleMemoryLeak.patch (535 bytes ) - added by aboudreault 16 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by aboudreault, 16 years ago

The styles are get with STYLEITEM "AUTO".

by aboudreault, 16 years ago

Attachment: styleMemoryLeak.patch added

comment:2 by aboudreault, 16 years ago

I joined a patch for one of the two memory leaks. The patch joined is for the styles not freed (8,320 bytes in 40 blocks are definitely lost in loss record 4 of 5). This ticket can be closed. You can have more information about the first memory leak (19,331 (1,968 direct, 17,363 indirect) bytes in 41 blocks are definitely lost in loss record 3 of 5 ) in the following ticket: http://trac.osgeo.org/mapserver/ticket/2729

comment:3 by dmorissette, 16 years ago

Resolution: fixed
Status: newclosed

Fixed. Committed the patch for the styleObj leak in SVN trunk r7854.

Note: See TracTickets for help on using tickets.