limitation in number of dlopen-s

From: Basile Starynkevitch [news] (basile-news_at_starynkevitch.net)
Date: 12/17/04


Date: Fri, 17 Dec 2004 21:12:29 +0000 (UTC)


Dear All,

An old friend of mine (coding a reflexive system which generates
program at runtime thru C files, which are compiled and dlopen-ed)
went into a limitation (of about 32 files, each a few hundred lines
long) when doing this. His distribution is probably a 2-3 years old
Mandrake.

Of course, the number of possible dlopen is limited (mostly by the
address space of the running process, also by file and disk
space). However, I don't expect it to be so low.

I worte a simple test program available on
http://starynkevitch.net/Basile/manydl.c which generate files genf_*.c
compile them and dlopen-s them. But my distribution (Debian/Sid with
glibc 2.3.2) and my kernel (2.6.9) are too recent for hurting such a
limit easily.

I can compile my program with gcc -o manydl -Wall -O manydl.c -ldl and
then run the executable
   ./manydl 1500
the argument to my program is the number of generated files
(1500 here). This works successfully on my system.

Could some people running older (ie distributions, glibc
versions, kernel versions) try and report the results?

IMHO, the most important limit is the address space. dlopen should
probably close its fd after having read its header and mmaped its
(data & text) segments. Is there any reason why dlopen could fail
before these limits?

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France