Reputation: 202
I am running into the need to better balance my octrees based not just on spacial distribution but also on memory usage per branch. Whats the best way in Perl to check memory usage per object generated and then as a ratio of memory available to that process ?
Upvotes: 2
Views: 298
Reputation: 820
Try the total_size function in Devel::Size:
use Devel::Size qw/total_size/;
print total_size {
a => [1,2,4],
b => [{
x => 2,
y => 3,
}, undef, 123],
c => 123,
}
# 975
You can get available memory from /proc/meminfo on linux.
Upvotes: 2