[Tile-serving] [osm2pgsql] Memory leaks of C++ version (Windows-only?) (#228)

alex85k notifications at github.com
Tue Dec 30 12:53:30 UTC 2014


@lonvia Thank you!
Most of the leak types are gone.
Now the most common (but small) leak is in ``set_prefix_and_tbls``:
```
      Start  3: test-middle-pgsql

3: Test command: C:\build_d\osm2pgsql-cmake\Debug\test-middle-pgsql.exe
3: Test timeout computed to be: 2000
3: Visual Leak Detector Version 2.4RC2 installed.
3: WARNING: Visual Leak Detector detected memory leaks!
3: ---------- Block 226 at 0x0000000088DB9440: 39 bytes ----------
3:   Leak Hash: 0xA9C12F5E, Count: 1, Total 39 bytes
3:   Call Stack (TID 1872):
3:     0x00000000EC05A6C0 (File and line number not available): MSVCR120D.dll!strdup
3:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\middle-pgsql.cpp (1058): test-middle-pgsql.exe!set_prefix_and_tbls + 0xB bytes
3:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\middle-pgsql.cpp (1071): test-middle-pgsql.exe!middle_pgsql_t::connect
3:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\middle-pgsql.cpp (1111): test-middle-pgsql.exe!middle_pgsql_t::start + 0x29 bytes
3:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\tests\test-middle-pgsql.cpp (51): test-middle-pgsql.exe!main
3:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (626): test-middle-pgsql.exe!__tmainCRTStartup + 0x19 bytes
3:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): test-middle-pgsql.exe!mainCRTStartup
3:     0x00000000FD6A16AD (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0xD bytes
3:     0x00000000FD8E4409 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x1D bytes
3:   Data:
3:     43 4F 50 59    20 6F 73 6D    32 70 67 73    71 6C 5F 74     COPY.osm 2pgsql_t
3:     65 73 74 5F    6E 6F 64 65    73 20 46 52    4F 4D 20 53     est_node s.FROM.S
3:     54 44 49 4E    3B 0A 00                                      TDIN;... ........

```
and the most problematic remaining leak is still in keyvals.hpp:
```
4: Test command: C:\build_d\osm2pgsql-cmake\Debug\test-output-multi-line.exe
4: Test timeout computed to be: 2000
4: Visual Leak Detector Version 2.4RC2 installed.
4: WARNING: Visual Leak Detector detected memory leaks!
4: ---------- Block 155842 at 0x000000004B42EC80: 32 bytes ----------
4:   Leak Hash: 0x60B8A2A9, Count: 1, Total 32 bytes
4:   Call Stack (TID 4892):
4:     0x00000000E130AFC0 (File and line number not available): MSVCR120D.dll!operator new
4:     c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 (848): test-output-multi-line.exe!std::_Wrap_alloc<std::allocator<char> >::allocate
4:     c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (2215): test-output-multi-line.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy + 0x2C bytes
4:     c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (2246): test-output-multi-line.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow + 0x18 bytes
4:     c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (1138): test-output-multi-line.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign + 0x12 bytes
4:     c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (726): test-output-multi-line.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > + 0x19 bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\keyvals.hpp (54): test-output-multi-line.exe!keyval::keyval + 0x48 bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\keyvals.cpp (112): test-output-multi-line.exe!keyval::addItem + 0x30 bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (187): test-output-multi-line.exe!addProtobufItem + 0x3C bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (390): test-output-multi-line.exe!parse_pbf_t::processOsmDataWays
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (513): test-output-multi-line.exe!parse_pbf_t::processOsmData + 0x1F bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (587): test-output-multi-line.exe!parse_pbf_t::streamFile + 0x1C bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse.cpp (39): test-output-multi-line.exe!parse_delegate_t::streamFile + 0x28 bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\tests\test-output-multi-line.cpp (82): test-output-multi-line.exe!main + 0x45 bytes
4:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (626): test-output-multi-line.exe!__tmainCRTStartup + 0x19 bytes
4:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): test-output-multi-line.exe!mainCRTStartup
4:     0x00000000FD6A16AD (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0xD bytes
4:     0x00000000FD8E4409 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x1D bytes
4:   Data:
4:     61 64 64 72    3A 68 6F 75    73 65 6E 75    6D 62 65 72     addr:hou senumber
4:     00 CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........
4: 
4: 
```
and 
```
4: 
4: ---------- Block 61715 at 0x000000004B4F74C0: 104 bytes ----------
4:   Leak Hash: 0x99988E92, Count: 1, Total 104 bytes
4:   Call Stack (TID 4892):
4:     0x00000000E130AFC0 (File and line number not available): MSVCR120D.dll!operator new
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\keyvals.cpp (112): test-output-multi-line.exe!keyval::addItem + 0xA bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (187): test-output-multi-line.exe!addProtobufItem + 0x3C bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (390): test-output-multi-line.exe!parse_pbf_t::processOsmDataWays
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (513): test-output-multi-line.exe!parse_pbf_t::processOsmData + 0x1F bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse-pbf.cpp (587): test-output-multi-line.exe!parse_pbf_t::streamFile + 0x1C bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\parse.cpp (39): test-output-multi-line.exe!parse_delegate_t::streamFile + 0x28 bytes
4:     c:\build_d\osm2pgsql-cmake\osm2pgsql-cpp\tests\test-output-multi-line.cpp (82): test-output-multi-line.exe!main + 0x45 bytes
4:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (626): test-output-multi-line.exe!__tmainCRTStartup + 0x19 bytes
4:     f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): test-output-multi-line.exe!mainCRTStartup
4:     0x00000000FD6A16AD (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0xD bytes
4:     0x00000000FD8E4409 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x1D bytes
4:   Data:
4:     40 7F 3A 54    ED 00 00 00    62 69 63 79    63 6C 65 00     @.:T.... bicycle.
4:     CD CD CD CD    CD CD CD CD    07 00 00 00    00 00 00 00     ........ ........
4:     0F 00 00 00    00 00 00 00    80 8A 3A 54    ED 00 00 00     ........ ..:T....
4:     79 65 73 00    CD CD CD CD    CD CD CD CD    CD CD CD CD     yes..... ........
4:     03 00 00 00    00 00 00 00    0F 00 00 00    00 00 00 00     ........ ........
4:     00 00 00 00    CD CD CD CD    00 00 00 00    00 00 00 00     ........ ........
4:     00 00 00 00    00 00 00 00                                   ........ ........
4: 
4: 
```

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/228#issuecomment-68354085
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20141230/c449563a/attachment.html>


More information about the Tile-serving mailing list