I have found that for CVs/subs Devel::Size will count entire package/class (GVs and every slice in the GV and all the shared key names of the stash and all sub stashes) that a CV is in for the size of a single sub. An XSUB with no optree comes in at a dozen KB. Be careful of what Devel::Size tells you.
Re^6: How can I free the memory of a XML::Simple-Object
Replies are listed 'Best First'.