Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Picture.Bitmap leaks memory? (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] Shorter interval for Digest Mode?
Next thread: [MBS] 2.9 final is online


[MBS] Picture.Bitmap leaks memory?   -   Mike D.
  Re: [MBS] Picture.Bitmap leaks memory?   -   Christian Schmitz
  Re: [MBS] Picture.Bitmap leaks memory?   -   Mike D.

[MBS] Picture.Bitmap leaks memory?
Date: 01.01.03 20:00 (Wed, 1 Jan 2003 11:00:50 -0800)
From: Mike D.
(RB 4.5.2, compiled for Win98)
I'm finding some situations where the following code leaks memory:

dim p as picture
p = NewColorPicture(w,h,d,temp)
p = p.bitmap

If I remove the line "p = p.bitmap" I get no leak.

I realize that the "p.bitmap" call is not needed (since I just
created the picture I'm guaranteed it to be a bitmap format, right?),
but it seems to me a bug for the bitmap call to leak memory.

Re: [MBS] Picture.Bitmap leaks memory?
Date: 01.01.03 20:57 (Wed, 1 Jan 2003 20:57:40 +0100)
From: Christian Schmitz
> (RB 4.5.2, compiled for Win98)
> I'm finding some situations where the following code leaks memory:
>
> dim p as picture
> p = NewColorPicture(w,h,d,temp)
> p = p.bitmap
>
> If I remove the line "p = p.bitmap" I get no leak.
>
> I realize that the "p.bitmap" call is not needed (since I just
> created the picture I'm guaranteed it to be a bitmap format, right?),
> but it seems to me a bug for the bitmap call to leak memory.

First, on Windows a call to NewColorPicture is just same as to
REALNewPicture. The plugin call's RB itself.

p.bitmap than should not leak as it should not do anything.

But the interesting question is:
How do you know the function leaks at all?

Mfg
Christian

Re: [MBS] Picture.Bitmap leaks memory?
Date: 03.01.03 19:02 (Fri, 3 Jan 2003 10:02:49 -0800)
From: Mike D.
>Subject: Re: [MBS] Picture.Bitmap leaks memory?
>From: <email address removed> (Christian Schmitz)
>Date: Wed, 1 Jan 2003 20:57:40 +0100
>Reply-To: <email address removed>
>> (RB 4.5.2, compiled for Win98)
>> I'm finding some situations where the following code leaks memory:
>>
>> dim p as picture
>> p = NewColorPicture(w,h,d,temp)
>> p = p.bitmap
>>
>> If I remove the line "p = p.bitmap" I get no leak.
>>
>> I realize that the "p.bitmap" call is not needed (since I just
>> created the picture I'm guaranteed it to be a bitmap format, right?),
>> but it seems to me a bug for the bitmap call to leak memory.
>
>First, on Windows a call to NewColorPicture is just same as to
>REALNewPicture. The plugin call's RB itself.
>
>p.bitmap than should not leak as it should not do anything.
>
>But the interesting question is:
>How do you know the function leaks at all?
>
>Mfg
>Christian

Well, I simply watch the VM free size and it drops by about 4MB (the
size of an image) every time I use it.

Now, the complicating factor is that I'm pulling these images from a
quicktime effect, which itself has weird behavior. For example, on
Mac, when you get a picture from a quicktime sequence, it's not
actually created until you draw the picture (to screen or to a
buffer). It apparently is just holding a pointer to the effect
creator buffer(?) or something.

I'll see if I can narrow it down. I've encountered leaks before in
the QTEffects code, so it may be a realbasic bug. (But I'm still
mystified why removing a call to P.Bitmap should appear to fix the
bug)...
?