Recent

Author Topic: TBGRAWinBitmap.ReallocBitmap: Windows error 87  (Read 257 times)

Onur2x

  • New member
  • *
  • Posts: 7
TBGRAWinBitmap.ReallocBitmap: Windows error 87
« on: July 06, 2020, 09:33:47 pm »
Hello circular i am write new components.
But I encounter some errors. I sent the files in the attachment. The error I received is where do I make an error in the txt file. Can you help me? RAM is constantly increasing.
My english very bad. I am sorry.
TBGRAWinBitmap.ReallocBitmap: Windows error 87

circular

  • Hero Member
  • *****
  • Posts: 3370
    • Personal webpage
Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
« Reply #1 on: July 07, 2020, 03:35:58 pm »
I suppose the memory leak comes from the following.

When you call GetPart or Resample, you get a new image. After using it, you need to free it.
Conscience is the debugger of the mind

Onur2x

  • New member
  • *
  • Posts: 7
Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
« Reply #2 on: July 07, 2020, 08:39:22 pm »
procedure TONButton.Paint;
var
img:TBGRABitmap;
begin
    if FSkindata <> nil then
    begin
    img:=TBGRABitmap.Create(FSkindata.Images);
      try
        Fresim.SetSize(Self.Width,Self.Height);
        if Enabled = True then
        begin
          case FDurum of
            bsNormal: DR := Rect(FNormal.FSSOL,
                FNormal.FSUST, FNormal.FSSAG, FNormal.FSALT);
            bsbasili: DR := Rect(FBasili.FSSOL,
                FBasili.FSUST, FBasili.FSSAG, FBasili.FSALT);
            bsuzerinde: DR :=Rect(FUzerinde.FSSOL,
                FUzerinde.FSUST, FUzerinde.FSSAG, FUzerinde.FSALT);
          end;
        end
        else
        begin
          DR := Rect(FPasif.FSSOL, FPasif.FSUST, FPasif.FSSAG, FPasif.FSALT);
        end;

        Fresim.StretchPutImage(Rect(0,0,Self.Width,Self.Height),img.GetPart(DR),dmLinearBlend);

        if Crop=true then
         CropToimg(Fresim);
      finally
        FreeAndNil(img);
      end;
    end;
  inherited;
end;
     
I guess you meant that way? 

circular

  • Hero Member
  • *****
  • Posts: 3370
    • Personal webpage
Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
« Reply #3 on: July 07, 2020, 08:47:42 pm »
No.

I meant something like:
Code: Pascal  [Select][+][-]
  1. part := img.GetPart(DR);
  2. ...
  3. part.Free;
  4.  
Conscience is the debugger of the mind

Onur2x

  • New member
  • *
  • Posts: 7
Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
« Reply #4 on: July 07, 2020, 08:54:37 pm »
Thnks

circular

  • Hero Member
  • *****
  • Posts: 3370
    • Personal webpage
Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
« Reply #5 on: July 07, 2020, 09:13:10 pm »
You're welcome.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018