[OPEN-ILS-DEV] PATCH: osrf_json_object.c (miscellaneous)

Mike Rylander mrylander at gmail.com
Sat Dec 8 19:11:57 EST 2007


On Dec 8, 2007 6:19 PM, Scott McKellar <mck9 at swbell.net> wrote:
>
> --- Mike Rylander <mrylander at gmail.com> wrote:
>
> <snip>
>
> > (FWIW, that last one is where we're leaking a bit, to the tune of
> > around 10k objects ... my guess is that json_query is to blame.)
>
> Indeed.
>
> In doJSONSearch() we call jsonObjectGetIndex() and assign the result
> to hash, but we never free hash.

While that's true, I believe that registered methods are not
responsible (and shouldn't) free parts of the ctx object.  AFAICT,
jsonObjectGetIndex() just returns a pointer to an existing object, in
this case the first element from the ARRAY type jsonObject that lives
at ctx->params.  Though I could be misunderstanding you ... Bill, care
to weigh in?

The other part that I'm not positive about, but I believe to be true
(and coded for),  is that osrfAppRespond() takes care of destroying
the object it is passed.  Basically, I'm not freeing anything that
comes out of the ctx object (hash, and all its descendants), nor
anything I return to the client.

Hrm... I do leave some jsonObjectIterator pointers laying about in
SELECT(), but those aren't used in the pool.

>
> After the call to SELECT() we need to insert the following line:
>
>         jsonObjectFree( hash );
>
> I can submit a patch if you like, but you can probably fix it faster
> yourself.  Meanwhile I'll keep looking for other leaks.  There may
> be some in SELECT(), which does the gruntwork for doJSONSearch().
>
>
> Scott McKellar
> http://home.swbell.net/mck9/ct/
>
>



-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list