[Python-Dev] const data (was: Unicode patches checked in)

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Thu, 16 Mar 2000 13:39:42 +0100 (CET)


Greg Stein wrote:
> 
> [me]
> > The static data is shared if the module is a shared object (.so).
> > If unicodedata is not a .so, then you'll have a seperate copy of the
> > database in each process.
> 
> Nope. A shared module means that multiple executables can share the code.
> Whether the const data resides in an executable or a .so, the OS will map
> it into readonly memory and share it across all procsses.

I must have been drunk yesterday<wink>. You're right.

> I don't believe this is Linux specific. This kind of stuff has been done
> for a *long* time on the platforms, too.

Yes.

> 
> Side note: the most effective way of exposing this const data up to Python
> (without shoving it onto the heap) is through buffers created via:
>    PyBuffer_FromMemory(ptr, size)
> This allows the data to reside in const, shared memory while it is also
> exposed up to Python.

And to avoid the size increase of the Python library, perhaps unicodedata
needs to be uncommented by default in Setup.in (for the release, not now).
As M-A pointed out, the module isn't isn't necessary for the normal
operation of the interpreter.

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252