[mapserver-users] static versus shared obj memory use

Andy Colson andy at squeakycode.net
Fri May 15 14:44:25 PDT 2015


Here is another stackoverflow:

http://stackoverflow.com/questions/2032779/will-multiple-instances-of-an-executable-built-with-static-libraries-share-any

mapserv can only share with itself.  Think of it as one file on disk 
equals one copy in ram.

-Andy


On 5/15/2015 4:34 PM, Richard Greenwood wrote:
> Thanks for the reply Andy. I had Googled a bit and found this
> stackoverflow
> <http://stackoverflow.com/questions/2649334/difference-between-static-and-shared-libraries>
> discussion in which the answer at the bottom said:
>
>     "The most significant advantage of shared libraries is that there is
>     only one copy of code loaded in memory, no matter how many processes
>     are using the library. For static libraries each process gets its
>     own copy of the code. This can lead to significant memory wastage."
>
> But I'm not sure if that's applicable with a web/fcgi application.
>
> rich
>
> On Fri, May 15, 2015 at 3:04 PM, Andy Colson <andy at squeakycode.net
> <mailto:andy at squeakycode.net>> wrote:
>
>     On 5/15/2015 3:59 PM, Richard Greenwood wrote:
>
>         I'm working on Linux and have statically linked mapserv for
>         convenience
>         but now I'm wondering if it is adversely affecting memory use. For
>         example, if I have five fcgi mapserv instance like:
>             mapserv.fcgi?map=mapfile1.map
>             mapserv.fcgi?map=mapfile2.map
>             mapserv.fcgi?map=mapfile3.map
>             mapserv.fcgi?map=mapfile4.map
>             mapserv.fcgi?map=mapfile5.map
>         Am I using more memory with my static build than if they all
>         referencing
>         the shared libmapserver.so?
>
>         Thanks,
>         rich
>
>
>     I believe you will pay for the cost of one executable, the others
>     will share the code pages, but get their own data pages.
>
>     So no, you probably are not using more memory using static build.
>
>     -Andy
>
>
>
>
> --
> Richard W. Greenwood, PLS
> www.greenwoodmap.com <http://www.greenwoodmap.com>




More information about the MapServer-users mailing list