[botan-devel] Memory Leaks with Botan 1.10.5 Amalgamation (via Botan Sqlite3)

Cory Trese cory.trese at gmail.com
Fri Nov 15 13:45:13 EST 2013


Hello,

I am a happy user of Botan 1.10.5 and BotanSqlite3 (
https://github.com/OlivierJG/botansqlite3)

This week I have been working on preparing my application for production
and have been measuring performance.

One troubling issue I have come across this week is memory leaks in my
Botan library, detected in Win32 using Visual Leak Detector.

Visual Leak Detector (https://vld.codeplex.com/) is a free, robust,
open-source memory leak detection system for Visual C++.

It is also reporting a lot of memory leaks in Botan. I am hopeful that
there is a solution -- perhaps there is a "Botan Cleanup" call I am unaware
of?


My configuration:

/*
* This file was automatically generated Fri Sep  6 15:07:13 2013 UTC by
* Digital at Void running './configure.py --no-autoload
--enable-modules=twofish,xts,pbkdf2,cmac,sha1 --gen-amalgamation --cc=msvc
--os=win32 --cpu=x86 --disable-shared --disable-asm'
*
* Target
*  - Compiler: cl /MD /O2
*  - Arch: x86_32/x86_32
*  - OS: windows
*/



Here are some of the leaks:



---------- Block 9732 at 0x04D8A378: 8 bytes ----------
  Call Stack:
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (9067):
HeroesOfSteel.win32.exe!Botan::PKCS5_PBKDF2::clone + 0x7 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2077):
HeroesOfSteel.win32.exe!Botan::Algorithm_Factory::make_pbkdf + 0xF bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (10936):
HeroesOfSteel.win32.exe!Botan::get_pbkdf + 0x2A bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (57):
HeroesOfSteel.win32.exe!Codec::GenerateWriteKey + 0xA bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (171):
HeroesOfSteel.win32.exe!GenerateWriteKey
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (106):
HeroesOfSteel.win32.exe!sqlite3CodecAttach + 0x27 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (131):
HeroesOfSteel.win32.exe!sqlite3_key + 0x13 bytes



---------- Block 9719 at 0x04DF60C0: 65536 bytes ----------
  Call Stack:
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2428):
HeroesOfSteel.win32.exe!Botan::`anonymous namespace'::do_malloc + 0xC bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2481):
HeroesOfSteel.win32.exe!Botan::Locking_Allocator::alloc_block + 0xB bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2391):
HeroesOfSteel.win32.exe!Botan::Pooling_Allocator::get_more_core + 0x13 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2304):
HeroesOfSteel.win32.exe!Botan::Pooling_Allocator::allocate
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (514):
HeroesOfSteel.win32.exe!Botan::MemoryRegion<unsigned int>::allocate + 0x1B
bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (540):
HeroesOfSteel.win32.exe!Botan::MemoryRegion<unsigned int>::resize + 0xC
bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (509):
HeroesOfSteel.win32.exe!Botan::MemoryRegion<unsigned int>::init + 0x42 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (663):
HeroesOfSteel.win32.exe!Botan::SecureVector<unsigned
int>::SecureVector<unsigned int> + 0x5F bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (4725):
HeroesOfSteel.win32.exe!Botan::Twofish::Twofish + 0x6A bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (4723):
HeroesOfSteel.win32.exe!Botan::Twofish::clone + 0x6D bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (13156):
HeroesOfSteel.win32.exe!Botan::CMAC::clone + 0x35 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2065):
HeroesOfSteel.win32.exe!Botan::Algorithm_Factory::make_mac + 0xF bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (7814):
HeroesOfSteel.win32.exe!Botan::MAC_Filter::MAC_Filter + 0x27 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (41):
HeroesOfSteel.win32.exe!Codec::InitializeCodec + 0x3B bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (16):
HeroesOfSteel.win32.exe!Codec::Codec
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (164):
HeroesOfSteel.win32.exe!InitializeNewCodec + 0x2B bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (105):
HeroesOfSteel.win32.exe!sqlite3CodecAttach + 0x9 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (131):
HeroesOfSteel.win32.exe!sqlite3_key + 0x13 bytes



---------- Block 103761 at 0x04B9F9E8: 8 bytes ----------
  Call Stack:
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (9067):
HeroesOfSteel.win32.exe!Botan::PKCS5_PBKDF2::clone + 0x7 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2077):
HeroesOfSteel.win32.exe!Botan::Algorithm_Factory::make_pbkdf + 0xF bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (10936):
HeroesOfSteel.win32.exe!Botan::get_pbkdf + 0x2A bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (57):
HeroesOfSteel.win32.exe!Codec::GenerateWriteKey + 0xA bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (171):
HeroesOfSteel.win32.exe!GenerateWriteKey
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (106):
HeroesOfSteel.win32.exe!sqlite3CodecAttach + 0x27 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (131):
HeroesOfSteel.win32.exe!sqlite3_key + 0x13 bytes



---------- Block 515 at 0x04BCE280: 8 bytes ----------
  Call Stack:
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree
(824):
HeroesOfSteel.win32.exe!std::_Tree_alloc<0,std::_Tree_base_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::pair<std::basic_string<char,std::char + 0xA bytes
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree
(799):
HeroesOfSteel.win32.exe!std::_Tree_alloc<0,std::_Tree_base_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::pair<std::basic_string<char,std::char + 0x8 bytes
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree
(894):
HeroesOfSteel.win32.exe!std::_Tree_buy<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocat
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree
(1008):
HeroesOfSteel.win32.exe!std::_Tree_comp<0,std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree
(1072):
HeroesOfSteel.win32.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::al
    c:\program files (x86)\microsoft visual studio 11.0\vc\include\map
(93):
HeroesOfSteel.win32.exe!std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::pair<st
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (11669):
HeroesOfSteel.win32.exe!Botan::Library_State::Library_State + 0x4D bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (11297):
HeroesOfSteel.win32.exe!Botan::Global_State_Management::global_state + 0x2B
bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.cpp (2501):
HeroesOfSteel.win32.exe!Botan::Allocator::get + 0x9 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (509):
HeroesOfSteel.win32.exe!Botan::MemoryRegion<unsigned char>::init + 0x2D
bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (663):
HeroesOfSteel.win32.exe!Botan::SecureVector<unsigned
char>::SecureVector<unsigned char> + 0x5F bytes
    e:\cocos2d-x-2.2\storytellercore\classes\win32\botan_all.h (2086):
HeroesOfSteel.win32.exe!Botan::OctetString::OctetString + 0x4C bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (14):
HeroesOfSteel.win32.exe!Codec::Codec + 0x6B bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codec.cpp (164):
HeroesOfSteel.win32.exe!InitializeNewCodec + 0x2B bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (105):
HeroesOfSteel.win32.exe!sqlite3CodecAttach + 0x9 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\codecext.c (131):
HeroesOfSteel.win32.exe!sqlite3_key + 0x13 bytes
    e:\cocos2d-x-2.2\storytellercore\classes\cppsqlite3.cpp (1223):
HeroesOfSteel.win32.exe!CppSQLite3DB::key + 0x14 bytes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20131115/5c816c1d/attachment-0001.html>


More information about the botan-devel mailing list