Jump to content

UniImage VS UniCanvas


Kast2k

Recommended Posts

Dear colleagues,

 

At the current time i'm developing a information software that will run on server and clients (raspberry).

Architecture (very common):

1. Server gets data from different sources and creating a bmp picture.

2. Clients are connecting server, getting picture and show it on form.

 

Problems:

1. If i'm using UniCanvas then Chromium receives stack overflow after few hours (4-5). No free memory error.

2. if i'm using UniImage then picture is blinking.

 

Picture is get by client on UniTimer.

 

Example:

procedure TframTest.tmrFillCNTValuesTimer(Sender: TObject);
var
  Loff:string;
  bmp:TBitmap;
begin
  bmp:=TBitmap.Create;
  try
    UniMainModule.SelectedRoute.FillcnvCounter(bmp,FBMPCounter,Loff);
    try
          UniImage2.BeginUpdate;
          UniImage2.Picture.Graphic.Assign(bmp);
          UniImage2.EndUpdate;
//          cnvCounter.BeginUpdate;
//          cnvCounter.BitmapCanvas.StretchDraw(cnvCounter.BitmapCanvas.ClipRect,bmp);
//          cnvCounter.EndUpdate;
        end;

      pnLineOffValue.Caption:=Loff;
    except
      on e:Exception do
        PostToLog('Cant find route '+UniMainModule.idRoute);

    end;
  finally
    bmp.Free;
  end;

May be i'm doing something wrong?

How can i receive picture from server without blinking or without memory overflow?

 

PS. I read that chromium have a garbage collector bug with Canvas.

 

Thank You.

Link to comment
Share on other sites

As temporary countermeasure i set Unitimer interval as 6000 (maximum production time available) and the result in Firefox-esr is about 10 hours, in Chrome - 6.5-7 hours.

 

It always seems to be strange that this browsers are getting data, increasing used memory, cleaning memory. But at one time something is going wrong and free memory is decreasing critically without any garbage collection. Almost unknown situation.

 

So sometimes i begin to think about using CrossVCL components, but the number (about 18) of current PC clients is pausing me.

Link to comment
Share on other sites

It is simplier that that.

 

Old picture memory just not being released when you assign new picture. That's all.

 

Just create large bitmap and you'll see it clearly.

I understand the process :) I dont understand what is happening inside browser at this moment :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...