Alex Rivera | Logout

Is there a way to see how much memory a variable uses?

Asked 2011-08-22T09:01:05.610
11

I am working with Perl for some months now. As for now, my scripts work but they are far from being perfect.

I would now like to optimize the memory usage, thus I am looking for a way to break down the memory usage per variable/hash.

Is there a way to see how much memory a variable uses?

Edit
Report

1 Answer

13

Devel::Size or Devel::Size::Report can be used to get memory usage for a variable/structure.

You might want to check perl guts illustrated to see what the numbers really mean.

answered 2011-08-22T09:30:32.633

Your Answer