Tips for keeping Perl memory usage low

前端 未结 6 1884
猫巷女王i
猫巷女王i 2020-12-04 06:29

What are some good tips for keeping memory usage low in a Perl script? I am interested in learning how to keep my memory footprint as low as possible for systems depending o

6条回答
  •  不知归路
    2020-12-04 06:35

    If you're really desperate you could try to mount some memory as a filesystem (tmpfs/ramdisk) and read/write/delete files on it. I guess the tmpfs implementation is smart enough to release the memory when you delete a file.

    You could also mmap (see File::Map, Sys::Mmap) a huge file on the tmpfs, an idea I got from Cache::FastMmap.

    Never tried, but it should work :)

提交回复
热议问题