Thread: Shared library support for postmaster

Shared library support for postmaster

From
Erik Hofman
Date:
Hi,

After a little test i manneged to create a shared library for
postmaster.
Originally the postmaster program was 3922308 bytes large, but after a
small modification in src/backend/Makefile it have a postgres binary of
26812 bytes and one shared library of 3981064 bytes.

This should save 115 megabytes of memory when 32 postmaster processed
have started!!

Could anyone find a reason not to do it this way?

BTW. The modification is:

postgres: fmgr.h $(OBJS) $(VERSIONOBJ)
        $(CC) -all -shared $(LDFLAGS) -o libpgback.so $(OBJS) $(OBJS1)
$(VERSIONOBJ)
        $(CC) $(CFLAGS) -o postgres main/SUBSYS.o -L.  $(LDFLAGS)
-lpgback


instead of:

postgres: fmgr.h $(OBJS) $(VERSIONOBJ)
        $(CC) $(CFLAGS) -o postgres  $(OBJS) $(OBJS1) $(VERSIONOBJ)
$(LDFLAGS)

Erik

Re: Shared library support for postmaster

From
Tom Lane
Date:
Erik Hofman <erik@ehofman.com> writes:
> After a little test i manneged to create a shared library for
> postmaster.
> Originally the postmaster program was 3922308 bytes large, but after a
> small modification in src/backend/Makefile it have a postgres binary of
> 26812 bytes and one shared library of 3981064 bytes.

> This should save 115 megabytes of memory when 32 postmaster processed
> have started!!

You wasted your time, I'm afraid.  On any reasonable Unix system, all
the backends share the same copy of the text segment anyway.

            regards, tom lane