Jack Jansen wrote:
On vrijdag, nov 29, 2002, at 21:47 Europe/Amsterdam, email@example.com wrote:
Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20813/Python
Modified Files: import.c Log Message: Slightly improved version of patch #642578: "Expose PyImport_FrozenModules in imp". This adds two functions to the imp module: get_frozenmodules() and set_frozenmodules().
Something that's been bothering me about frozen modules in the classical sense (i.e. those that are stored in C static data structures) is that the memory used by them is gone without any chance at recovery. For big frozen Python programs that are to be run on small machines this is a waste of precious memory.
With modules "frozen" with set_frozenmodules you could conceivably free the data again after it has been imported (similar to what MacPython-OS9 does with modules "frozen" in "PYC " resources).
Would that be worth the added complexity?
Allocating the data on the heap would prevent sharing the static data between processes (provided you have multiple of the running), so if you want to add that feature, please make it an option and not the default.
mxCGIPython heavily relies on the fact that frozen modules are shared between processes.