shared lib from python code?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Feb 23 05:48:49 EST 2009
En Mon, 23 Feb 2009 08:10:16 -0200, Gabriel Rossetti
<gabriel.rossetti at arimaz.com> escribió:
> I would like to know if it is possible to turn python code into a shared
> lib? I have several processes that use the same base code, and it seems
> like every process loads the "shared" code into memory. I would like it
> to be loaded once and shared, like a .so in linux or a .dll in windows
> and have the interpreters use the dared copy. Is there a way to do this?
I don't think so.
What you consider "code" isn't usually just code: there are functions,
classes, instances, constants, modules, docstrings... a myriad of objects.
You can't share objects between processes.
Although true code objects are immutable and *could* be shared (with a lot
of work), I don't think code objects actually could take so much memory as
to be a problem.
--
Gabriel Genellina
More information about the Python-list
mailing list