64bit perl and memory usage

Toby Corkindale tjc at wintrmute.net
Wed Jul 18 17:55:43 BST 2007


alex at owal.co.uk wrote:
> Because of some massively memory wasteful programs I am approaching the
> maximum memory limit per process. I am moving to 64 bit perl (because the
> boss said so). I'm trying it out now on some x86 boxes with a 64 bit
> version of Solaris 10.
> 
> Now from first glance it seems like the programs are using quite a bit
> more memory with 64 bit perl than they did with 32. I have a vague
> understanding that pointers are double in size, which is why the maximum
> memory is so much larger.

Also, the way the CPU deals with memory is now on a different
granularity.. So many instructions or bits of data have to be padded out
by the compiler, which occurred on 32bit, but now it has to be done
twice as much.
The thing is, at the worst possible edge case, that would only double
your memory usage.. yet by going from 32bit to 48bit addressing out of
the CPU, you have gained 2^16 times as much memory. (Well, potentially,
if you pack the machine with high capacity RAM that might not exist yet).

So, yes, it's normal that you're now seeing higher memory usage.

You can just throw (yet more) RAM at the problem, and that's one solution.

I still think it's worth trying to improve the program though.
If you use disk for storage instead, the kernel can be quite smart about
working out which bits need to be cached in ram, or not, for you.

tjc


More information about the london.pm mailing list