F
Fred
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?
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?