Reducing Perl memory usage


The imitable Brian D Foy:

Don’t let people use your program. Whenever I’ve done that, I’ve reduced the memory footprint by about 100%. It also cuts down on support requests.

This made my day.

Jokes aside, has two words. The biggest difference for me was point three in his list. Read <files> line by line if they’re massive, rather than loading them into memory at once. This definitely helps with multiple gigabytes of logs.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.