On Memory consumption of KDevelop-PG

Milian Wolff mail at milianw.de
Sat Dec 19 03:36:26 UTC 2009


On Saturday 19 December 2009 03:50:01 Milian Wolff wrote:
> Hey all!
> 
> I did a massif run with duchainify on Mediawiki, and well as far as I can
>  see there is no apparent memory leak.
> 
> http://mwolff.pastebin.com/f3581a8d6
> 
> What bugs me is the peak... See also:
> http://mwolff.pastebin.com/f4a66d631
> 
> I mean, it's pretty clear why we have a pretty high memory consumption:
> 
> - every visited node gets an Ast, even those that are just general helpers
> (AST == Tree.. duh)
> 
> - every Ast has two qint64 + a pointer _at least_, meaning: sizeof(AstNode)
>  == 32, most "specialized" nodes have at least one pointer to a child
>  element, so lets say sizeOf(node) = 36
> 
> - the phpfunctions file alone has 1.5 mio nodes (and this file is pretty
>  simple imo, no logical expressions or stuff like that which will likely
>  blow up the node number greatly, I mean the massif peak is somewhere
>  later, dunno how to find the exact file... but it's _not_ the internal
>  file)

It's mediawiki/includes/ZhConversion.php

Basically one frikkin huge array that maps multibyte chars as far as I can 
see... It's ~380K big, has nearly 17k lines... And it has 11.7 mio nodes 
according to my callgrind output (number of times Php::Visitor::visitNode gets 
called).

380k vs.

99.01% (145,951,541B) (heap allocation functions) malloc/new/new[], --alloc-
fns, etc.
->60.70% (89,478,400B) 0x1720D04A: KDevPG::BlockType::init(int) (kdev-pg-
memory-pool.h:46)

Imo ridiculous... 

-- 
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/20091219/3a1ba869/attachment.sig>


More information about the KDevelop-devel mailing list