On Thu, Mar 8, 2012 at 9:28 AM, Pavel Ivanov <paiva...@gmail.com> wrote:
>> Question:  Does anybody know of a better way to get memory shared among
>> processes other than to create a fake file and mmap() it?  Are there some
>> magic options to mmap() (perhaps Linux-only options) that prevent it from
>> actually writing to disk?
>
> Why don't you use shm_open() instead of a real file? I'm not sure
> though how it behaves with chroot jail.

I do not recall the full semantics of shm_open(), but I _think_ that
it shares the sysv shared-memory problem where the memory sticks
around until explicitly deleted.  Using a fake file with mmap() will
create a segment which only exists until the last process using it
goes away.  This can become a resource issue on some systems.  Also,
the name would have to be carefully constructed to prevent conflicts,
as the namespace may not be the same as the file path namespace (even
path-like names may have different length restrictions).  Like maybe
base64(hash(canonical_path(dbpath))).

BTW, the SQLite docs indicate that as of 3.7.4, you can arrange to use
an exclusive mode which allows WAL to work without shm.  That may be a
reasonable approach for some subset of users with this kind of
problem.

-scott
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to