[geos-devel] Geos 3 library size

Frank Warmerdam warmerdam at pobox.com
Mon Jan 14 14:55:55 EST 2008

Tim Mitchell wrote:
> Hi,
> I'm new to geos and have just downloaded an svn snapshot and built the 
> libraries on windows XP using the visual studio solution files in 
> build/msvc80 using 2005 Express edition.  I am using the library via the 
> shapely python interface and it seems to work.
> However the resulting geos.lib is 113Mb which is twice the size of the 
> debug build (47 Mb).  I find hard to believe the release lib is bigger 
> than the debug lib and all this from 6Mb of source (using it will triple 
> the size of my app!!).  I am a C person and have never touched C++ 
> before and I just wanted to check that these file sizes are correct.


I build GEOS with the nmakefile's and I see:

warmerda at gdal3200% ls -l *.lib
-rwxr-xr-x 1 warmerda None 19677468 Dec 20 17:32 geos.lib
-rwxr-xr-x 1 warmerda None    23382 Dec 20 17:32 geos_c_i.lib
-rwxr-xr-x 1 warmerda None    23160 Dec 11 23:39 geos_i.lib

warmerda at gdal3200% ls -l *.dll
-rwxr-xr-x 1 warmerda None 823296 Dec 20 17:32 geos_c_fw.dll
-rwxr-xr-x 1 warmerda None 978944 Dec 20 17:32 geos_fw.dll

I find it bizarre that your release build should be so much larger
than the debug build.  But I don't think the size of the .lib file
is a reflection on what will actually end up in your linked .exe or
.dll as all sorts of stuff tends to get duplicated in each .obj in a .lib
file, but then boiled by down by the linker when producing a dll or exe.

Looking at my build, I suspect that the C DLL is linking in a copy of
all used code from the main C++ DLL which I think I'll look into.  It wasn't
my expectation that this would happen and it isn't how things work
on linux.  But that isn't your problem.

So my advice is to look instead at the size of DLL that ends up being
used by Shapely and determine if that is large or not.  Make sure it
gets built without debug info when checking the size.  If that is still
huge, consider building GEOS with the nmakefile's instead of the solutions.
(or perhaps carefully compare the build options).

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the geos-devel mailing list