RFC-24: published implementation proposal on bugzilla

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Tue Mar 6 02:43:11 EST 2007


On 3/5/07, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
> Wow, thanks for all your hard work on this (and Tamas with all the feedback).Is there any
> performance hit with the reference counting and dynamic memory allocation? And if so, can
> it be quantified?

Right now I'm more focused on correctness than on perf, but *in
theory* it should provide a little boost because mapserver is not
going to allocate at every startup

MS_MAX_NUM_LAYERS*sizeof(layerObj)

much of memory, instead it will allocate:

MS_MAX_NUM_LAYERS*sizeof(layerObj*) + numlayers*sizeof(layerObj)

In cases where MS_MAX_NUM_LAYERS is quite larger that numlayers
dynamic allocation will be quite a saving. Because of this it should
be possible now to ship mapserver with larger values of
MS_MAX_NUM_LAYERS without slowing down the users that will only use a
few layers.

At this time I don't have any numbers to back this theory, so I could
be entirely wrong, but the theory seems reasonable ;-)

Umberto

>
> Steve
>
> >>> On 3/4/2007 at 9:46 AM, in message
> <75b4b93e0703040746v129adf71ya36c185b4ac98f46 at mail.gmail.com>, Umberto
> Nicoletti <umberto.nicoletti at GMAIL.COM> wrote:
> > I have been working on an example implementation of rfc-24 and the
> > fruit of my labor is attachment #632 to:
> > http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=2032
> >
> > Direct link:
> > http://mapserver.gis.umn.edu/bugs/attachment.cgi?id=632&action=view
> >
> > Apply this patch to cvs HEAD to see how rfc24 would be implemented.
> > The patch only modifies the map and layer objects, the rest is still
> > unmodified.
> >
> > Key points:
> > 1. refactor map->layers to be an array of pointers instead of a array of
> > structs
> > 2. allocation of a new layerObj only happens when needed, thus conserving
> > memory
> > (allowing for large values of MAX_NUM_LAYERS with minimal waste of memory)
> > 3. wrap map->layers access with GET_LAYER macros to ease future developments
> > (i.e. removal of MAX_NUM_LAYERS)
> > 4. check that layer->map is not null before using it and raise a new
> > error if it is (MS_NULLPARENTERR)
> > 5. reference counter for mapObj and layerObj
> > 6. modification of mapserver core and swig interface files to do reference
> > counting for map and layers (incr and decr)
> > 7. created unit tests for python (mapscript/python/tests/cases/refcount.py)
> > to
> > test the functionality of the previous items. This has not been added to
> > runtests.py yet
> >
> > Due to the large extent of the changes I have also made available
> > items 1,2,3 and item 4 available as two separate patches.
> >
> > Happy hacking and tell me what you think,
> > Umberto
>
>



More information about the mapserver-dev mailing list