Rakudo and Fakecutable Memory Requirements
chromatic
chromatic at wgz.org
Sat Aug 28 02:18:07 UTC 2010
I've been reviewing memory leaks and memory usage in Rakudo. A series of big
(bigger than 1Mb) allocations occurs as part of loading Rakudo from the perl6
fakecutable. As far as I can tell, it's completely unnecessary: it's
PackFile_new() reading the contents of the contained packfile into memory.
As the fakecutable already contains this packfile in a native form as part of
the executable, there's no need to copy this memory, and we can save Rakudo a
few MB.
The inline patch (not for application) does so, but it causes segfaults during
global destruction as free()ing this memory is inappropriate. Admittedly
hijacking the is_mmap_ped flag on the PackFile is the wrong approach, but when
I skip global destruction, I can see memory savings.
Someone who knows (or wants to know) the packfile code better than I do might
be able to figure out a better approach.
-- c
diff --git a/tools/dev/pbc_to_exe.pir b/tools/dev/pbc_to_exe.pir
index 804ea65..f37952b 100644
--- a/tools/dev/pbc_to_exe.pir
+++ b/tools/dev/pbc_to_exe.pir
@@ -95,7 +95,7 @@ HEADER
Parrot_set_run_core(interp, (Parrot_Run_core_t)RUNCORE);
Parrot_set_flag(interp, PARROT_DESTROY_FLAG);
- pf = PackFile_new(interp, 0);
+ pf = PackFile_new(interp, 1);
if (!pf)
return 1;
More information about the parrot-dev
mailing list