mismatched free/delete in typeregister.h

Milian Wolff mail at milianw.de
Fri May 27 16:48:44 UTC 2011


Here is a valgrind warning I just noticed. Quite deep inside the DUChain code 
- David, do you happen to know more on how to handle this warning?

Or could someone else explain me the custom new calls in typeregister.h's copy 
and abstracttype.h's copyDataDirectly ?

==16229== Mismatched free() / delete / delete []
==16229==    at 0x4C27FFF: operator delete(void*) (vg_replace_malloc.c:387)
==16229==    by 0xC84E46D: KDevelop::TypeFactory<KDevelop::FunctionType, 
KDevelop::FunctionTypeData>::copy(KDevelop::AbstractTypeData const&, 
KDevelop::AbstractTypeData&, bool) const (typeregister.h:99)
==16229==    by 0xC84A875: 
KDevelop::TypeSystem::copy(KDevelop::AbstractTypeData const&, 
KDevelop::AbstractTypeData&, bool) const (typeregister.cpp:58)
==16229==    by 0xC85ED28: 
KDevelop::AbstractTypeDataRequest::createItem(KDevelop::AbstractTypeData*) 
const (typerepository.cpp:50)
==16229==    by 0xC860F51: KDevelop::Bucket<KDevelop::AbstractTypeData, 
KDevelop::AbstractTypeDataRequest, true, 
0u>::index(KDevelop::AbstractTypeDataRequest const&, unsigned int) 
(itemrepository.h:641)
==16229==    by 0xC85F65E: 
KDevelop::ItemRepository<KDevelop::AbstractTypeData, 
KDevelop::AbstractTypeDataRequest, true, true, 0u, 
1048576u>::index(KDevelop::AbstractTypeDataRequest const&) 
(itemrepository.h:1440)
==16229==    by 0xC85E7D0: 
KDevelop::TypeRepository::indexForType(TypePtr<KDevelop::AbstractType>) 
(typerepository.cpp:104)
==16229==    by 0xC84B29A: KDevelop::AbstractType::indexed() const 
(abstracttype.cpp:101)
==16229==    by 0xC795F9C: 
KDevelop::DUContext::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) 
const::Checker::check(KDevelop::Declaration*) (ducontext.cpp:680)
==16229==    by 0xC7965A3: 
KDevelop::DUContext::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(ducontext.cpp:726)
==16229==    by 0x33957666: 
Cpp::CppDUContext<KDevelop::DUContext>::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(cppducontext.h:390)
==16229==    by 0xC796A1A: 
KDevelop::DUContext::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(ducontext.cpp:767)
==16229==    by 0x33956EF2: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(cppducontext.h:281)
==16229==    by 0x339BFC3D: Cpp::FindDeclaration::closeIdentifier(bool) 
(cppducontext.cpp:228)
==16229==    by 0x3395AF68: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevelop::QualifiedIdentifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(cppducontext.h:363)
==16229==    by 0x3395704B: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(cppducontext.h:286)
==16229==    by 0xC797961: 
KDevelop::DUContext::findDeclarations(KDevelop::QualifiedIdentifier const&, 
KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> const&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(ducontext.cpp:857)
==16229==    by 0x33963808: DeclarationBuilder::applyFunctionSpecifiers() 
(declarationbuilder.cpp:1564)
==16229==    by 0x3395DF6A: 
DeclarationBuilder::visitDeclarator(DeclaratorAST*) 
(declarationbuilder.cpp:354)
==16229==    by 0x3394ACE2: 
ContextBuilder::visitInitDeclarator(InitDeclaratorAST*) 
(contextbuilder.cpp:891)
==16229==    by 0x3395D517: 
DeclarationBuilder::visitInitDeclarator(InitDeclaratorAST*) 
(declarationbuilder.cpp:230)
==16229==    by 0x33C6E66B: Visitor::visit(AST*) (visitor.cpp:114)
==16229==    by 0x3394A403: 
ContextBuilder::visitFunctionDeclaration(FunctionDefinitionAST*) 
(contextbuilder.cpp:606)
==16229==    by 0x33991411: 
TypeBuilder::visitFunctionDeclaration(FunctionDefinitionAST*) 
(typebuilder.cpp:534)
==16229==    by 0x3395D0FD: 
DeclarationBuilder::visitFunctionDeclaration(FunctionDefinitionAST*) 
(declarationbuilder.cpp:164)
==16229==  Address 0x370f7610 is 0 bytes inside a block of size 40 alloc'd
==16229==    at 0x4C28658: operator new[](unsigned long) 
(vg_replace_malloc.c:305)
==16229==    by 0xC84E544: KDevelop::FunctionTypeData& 
KDevelop::AbstractType::copyDataDirectly<KDevelop::FunctionTypeData>(KDevelop::FunctionTypeData 
const&) (abstracttype.h:254)
==16229==    by 0xC84E3F1: KDevelop::TypeFactory<KDevelop::FunctionType, 
KDevelop::FunctionTypeData>::copy(KDevelop::AbstractTypeData const&, 
KDevelop::AbstractTypeData&, bool) const (typeregister.h:94)
==16229==    by 0xC84A875: 
KDevelop::TypeSystem::copy(KDevelop::AbstractTypeData const&, 
KDevelop::AbstractTypeData&, bool) const (typeregister.cpp:58)
==16229==    by 0xC85ED28: 
KDevelop::AbstractTypeDataRequest::createItem(KDevelop::AbstractTypeData*) 
const (typerepository.cpp:50)
==16229==    by 0xC860F51: KDevelop::Bucket<KDevelop::AbstractTypeData, 
KDevelop::AbstractTypeDataRequest, true, 
0u>::index(KDevelop::AbstractTypeDataRequest const&, unsigned int) 
(itemrepository.h:641)
==16229==    by 0xC85F65E: 
KDevelop::ItemRepository<KDevelop::AbstractTypeData, 
KDevelop::AbstractTypeDataRequest, true, true, 0u, 
1048576u>::index(KDevelop::AbstractTypeDataRequest const&) 
(itemrepository.h:1440)
==16229==    by 0xC85E7D0: 
KDevelop::TypeRepository::indexForType(TypePtr<KDevelop::AbstractType>) 
(typerepository.cpp:104)
==16229==    by 0xC84B29A: KDevelop::AbstractType::indexed() const 
(abstracttype.cpp:101)
==16229==    by 0xC795F9C: 
KDevelop::DUContext::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) 
const::Checker::check(KDevelop::Declaration*) (ducontext.cpp:680)
==16229==    by 0xC7965A3: 
KDevelop::DUContext::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(ducontext.cpp:726)
==16229==    by 0x33957666: 
Cpp::CppDUContext<KDevelop::DUContext>::findLocalDeclarationsInternal(KDevelop::Identifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(cppducontext.h:390)
==16229==    by 0xC796A1A: 
KDevelop::DUContext::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(ducontext.cpp:767)
==16229==    by 0x33956EF2: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(cppducontext.h:281)
==16229==    by 0x339BFC3D: Cpp::FindDeclaration::closeIdentifier(bool) 
(cppducontext.cpp:228)
==16229==    by 0x3395AF68: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevelop::QualifiedIdentifier 
const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> 
const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(cppducontext.h:363)
==16229==    by 0x3395704B: 
Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 
256> const&, KDevelop::CursorInRevision const&, 
TypePtr<KDevelop::AbstractType> const&, 
KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext 
const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const 
(cppducontext.h:286)
==16229==    by 0xC797961: 
KDevelop::DUContext::findDeclarations(KDevelop::QualifiedIdentifier const&, 
KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> const&, 
KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const 
(ducontext.cpp:857)
==16229==    by 0x33963808: DeclarationBuilder::applyFunctionSpecifiers() 
(declarationbuilder.cpp:1564)
==16229==    by 0x3395DF6A: 
DeclarationBuilder::visitDeclarator(DeclaratorAST*) 
(declarationbuilder.cpp:354)
==16229==    by 0x3394ACE2: 
ContextBuilder::visitInitDeclarator(InitDeclaratorAST*) 
(contextbuilder.cpp:891)
==16229==    by 0x3395D517: 
DeclarationBuilder::visitInitDeclarator(InitDeclaratorAST*) 
(declarationbuilder.cpp:230)
==16229==    by 0x33C6E66B: Visitor::visit(AST*) (visitor.cpp:114)
==16229==    by 0x3394A403: 
ContextBuilder::visitFunctionDeclaration(FunctionDefinitionAST*) 
(contextbuilder.cpp:606)
==16229==    by 0x33991411: 
TypeBuilder::visitFunctionDeclaration(FunctionDefinitionAST*) 
(typebuilder.cpp:534)
==16229== 

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110527/1d789d70/attachment.sig>


More information about the KDevelop-devel mailing list