Page 1 of 1

RichView need to much memory !

Posted: Tue Mar 20, 2007 12:56 am
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 !

Posted: Tue Mar 20, 2007 6:38 am
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.

Posted: Tue Mar 20, 2007 11:46 am
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...

Posted: Tue Mar 20, 2007 1:54 pm
by Sergey Tkachenko
No, Assign must be more efficient than loading from stream.
I'll do some tests and reply later today.

Posted: Tue Mar 20, 2007 8:45 pm
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...

Posted: Wed Mar 21, 2007 4:29 am
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...

Posted: Wed Mar 21, 2007 6:31 am
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.