Finding the size of a rather complicated hash-structure
From: Fred (na_at_na.no)
Date: 10/27/04
- Next message: Julie: "help in parsing xml messages"
- Previous message: Anno Siegel: "Re: Compiling or Hiding Perl"
- Next in thread: Anno Siegel: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Anno Siegel: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Peter Wyzl: "Re: Finding the size of a rather complicated hash-structure"
- Reply: ko: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Ben Morrow: "Re: Finding the size of a rather complicated hash-structure"
- Reply: ctcgag_at_hotmail.com: "Re: Finding the size of a rather complicated hash-structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Oct 2004 11:26:53 +0200
Hi group
Ok, so I've got a rather complicated hash-structure that I'd like to find
the size of. Size in consumed bytes of memory. Just because I'm curious.
And I've done the obligatory searches for finding sizes of stuff, and I'm
not much the wiser. Exept I've come to understand that there isn't any
bult-in functionality to do this for such structures.
So here I am then. Needing help!
My hash-structure looks something like this:
$tree = {
<key> => {
'name' => <str>,
'file' => <str>,
'architectures' => {
<key> => {
'name' => <str>,
'file' => <str>,
'components' => {
<key> = {
'name' => <str>,
'lib' => <str>
}
}
}
}
}
};
Actually it's much bigger, but this gives you a general idea of what it's
like. For each anonymous hash, the '<key>' have several elements,
typically around a hundred in $tree, one or two in
$tree->{<key>}->{'architectures'} and none or a couple in
$tree->{<key>}->{'architectures'}->{<key>}->{'components'}.
I suppose I could loop through tree, pushing name and file to an array,
looping through the architectures for each element in tree, and pushing
name and file to the same array, and doing the same with the components.
And then just flattening the array and use length(). But...that's kinda
dirty.....
(Not that I don't like my gals dirty...and perl's my bitch...so I guess I
might as well go for it...hehe! :-D )
But anyway...any good suggestions on how I can find out how many bytes of
memory my Frankenstein-hash is consuming, without writing a whole program
to find it? Or doing it the 'dirty' way?
- Next message: Julie: "help in parsing xml messages"
- Previous message: Anno Siegel: "Re: Compiling or Hiding Perl"
- Next in thread: Anno Siegel: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Anno Siegel: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Peter Wyzl: "Re: Finding the size of a rather complicated hash-structure"
- Reply: ko: "Re: Finding the size of a rather complicated hash-structure"
- Reply: Ben Morrow: "Re: Finding the size of a rather complicated hash-structure"
- Reply: ctcgag_at_hotmail.com: "Re: Finding the size of a rather complicated hash-structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|