[Lazarus] Buffer dealocating between program and C++ library
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu May 12 11:04:30 CEST 2011
On Wed, 11 May 2011 19:49:15 -0300
Leonardo M. Ramé <l.rame at griensu.com> wrote:
>[...]
> > > if @lGetDicomImage <> nil then
> >
> > if lGetDicomImage <> nil then
> >
> > What mode are you using? Delphi?
>
> No, I'm using objfpc.
Then the "if @lGetDicomImage <> nil then" is a tautology.
> > > if @lDeleteBuffer <> nil then
> > > lDeleteBuffer(lBuffer); // <----- memory keeps increasing here.
> > > end;
> >
> > end;
> > if lBuffer<>nil then
> > lDeleteBuffer(lBuffer);
>
> I don't understand this. Do you mean, I should call lDeleteBuffer aftert
> the "end;" that closes the loop?.
Yes. The C code was not enough to be sure about the state of lBuffer.
BTW, I'm not sure about the "out" in cdecl. Better use the real
equivalent "var".
Mattias
More information about the Lazarus
mailing list