RichView need to much memory !

General TRichView support forum. Please post your questions here
Post Reply
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

RichView need to much memory !

Post by skydiablo »

hi...

i create a chat-control and use a richview to display the chatlog... with many gif animations and colored text. but ever line i add, the tastmanager show me the exe increase 5-20 kb more memory needed ?

it is possible that the richeview dont free the grafic-objects on free ? so i can use a already created grafik-object and dont must create for ever smilie a new grafik-object, yes, i assigned it, but it need too many memroy !!!!!

and yes, i use already existings styles and dont create for ever line a new style...

what can i do too, to save memory ?

greez & thx, sky...


EDIT:

and if MANY smilies displayed then i get this message:

---------------------------
XXXXXXXXXXXXXXXX
---------------------------
Leinwand/Bild erlaubt kein Zeichnen.
---------------------------
OK
---------------------------

translation: canvas dont allow to draw !
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, which version of TRichView do you use? There were some changes for more efficient using memory and resources for gif animations.
(but the latest change was related to TGifImage, TJvGifImage should be testest yet)

Next, there is a simple way to save resources for graphics, I believe it works with TJvGifImage too. When adding image in chat, copy it using Assign method instead of loading from file/stream. Copied images must share graphic data.
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

Post by skydiablo »

okay... big thx... i use TRichView 1.9.24 and the JEDI GIF Class...

now i have a smilie-manager... its a simple TList of TJvGifImage... and if i add a smilie, create a new TJvGifImage and assigne one of the smilies from the smilie-manager... okay... i tra to convert my smilie manager to a TList of TMemroyStream and if i add a smilie, i load the source with TJvGifImage.LoadFromStream from the smilie-manager, maybe ist works ?

greez, sky...
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, Assign must be more efficient than loading from stream.
I'll do some tests and reply later today.
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

Post by skydiablo »

but isnt it possible that the RV dont free the grafiks ? so i can use the TJvGifImage instans from the smilie-manager, and the smilie-manager free the grafiks by its own ?

greez, sky...
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

Post by skydiablo »

okay... it wasnt easy, but i found it in the RV code:

Unit: RVItem

Code: Select all

destructor TRVGraphicItemInfo.Destroy;
begin
//  Image.Free;  <--- just kill this
  ImageCopy.Free;
  {$IFNDEF RVDONOTUSEANIMATION}
  FAnimator.Free;
  {$ENDIF}
  inherited Destroy;
end;
now can i use the TJvGifImage object from my smiliemanger and i dont must create a new TJvGifImage object for any smilie... but i see, the TRVGraphicItemInfo create a copy from the input Grafik:

Code: Select all

ImageCopy.Free;
it is possible to work without this copy ? and i must say i have the version:

1.9.15.1

maybe you can give me some tips ?

greez & thx, sky...
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

ImageCopy is created only in 256-color mode. This is a bitmap converted to some palette. It does not make too much sense now, because new versions of Windows do not support 256-color resolution.

Memory and resources are used not only for storing image, but also for storing animator (FAnimator). Please upgrade to v1.9.24 or newer, it uses resources for animator much more effectively.
Post Reply