----- "Jason Rappleye" <jason.rappleye@xxxxxxxx> wrote:
> Hi,
Hi Jason,
> I found a memory leak when using metrics of type PM_TYPE_STRING in a
> perl PMDA. I tracked the problem down to PMDA.xs:fetch_callback, which
> populates atom->cp by calling strdup with the string returned from the
> fetch callback. Unfortunately, the memory allocated here by strdup is
> never freed.
*nod*
> This might be a bit of a hack, but I'm not knowledgeable enough about
> XS to propose a different solution. If someone else has a better idea,
> by all means, please speak up :-)
Yeah, thats fine - there is a way to free it, by making the saved string
global and also testing/freeing it in the fetch routine after pmdaFetch.
I've tweaked your patch to do that & committed it to dev branch. Oh and
also made a version change to 1.09 for that interface (from 1.08) so you
can tell which package has the fix (will go out in pcp 3.4 I'd expect).
cheers.
--
Nathan
|