Re: [PATCH 5/9] New probe type: DTrace USDT probes.

Sergio Durigan Junior
2014-10-10T18:44:58Z

On Friday, October 10 2014, Jose E. Marchesi wrote:

> > You should free the enablers VEC in the end of the function. You could
> > probably make a cleanup and call it later.
> >
> > Hmm, I don't see the need of doing a deep copy of the vector, nor I
> > remember why I felt it was necessary to do it when I wrote the original
> > code.
> >
> > I changed that to:
> >
> > /* Add the vector of enablers to this probe, if any. */
> > ret->enablers = enablers;
> >
> > But maybe(probably) I am missing something? :?
>
> Hm, right. But if you do that, you will have to adjust
> dtrace_probe_destroy, because it will be freeing the same 'enablers'
> over and over...
>
> Aaah, that was indeed the reason! A "DOF probe" translates into 0 or
> more gdb probes, and they all share the same vector of enablers.
>
> Maintaining a copy of the enablers per gdb probe makes it trivial to
> manage its memory. Otherwise we would need to keep track of which
> enabler vectors are shared by which gdb probes... argh!
>
> I will roll back to the deep copy approach :)

:-)

And then you need that cleanup I mentioned before :-P.

--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible