Page 1 of 1

Brush in text formatting code may not freed?

Posted: Tue Jul 18, 2017 11:07 pm
by lazi
I am using a large listview gadget with brushes in each row. As far as I can see when the brushes are freed by Hollywood then recreated again and assigned to the listview again, the free memory is continue to diminish.

May it be a bug or feature that MUI linked brushes are cannot be free in MUI?

It is just a hypothethical question. If there is a need I will create a test case.

Bye

Re: Brush in text formatting code may not freed?

Posted: Sat Jul 22, 2017 2:31 pm
by airsoftsoftwair
It's a feature :) Brushes are cached by MUI Royale for performance reasons. Is this a problem for you?

In RapaGUI it's actually also documented, see here.

Re: Brush in text formatting code may not freed?

Posted: Sun Aug 20, 2017 12:04 pm
by lazi
Thanks for the clarification!

The main confusion is effected by the OS4 avail results. It does not reflect correct free memory amount. While it seems sometime that no more free memory displayed at the WB menu bar or the output of the avail command however the programs can still allocate memory. It seems to be normal with the new memory management of the OS4 if lots of small allocations freed (somewhere I did read about this but can't find now).

Anyway stay on topic, yes it makes me some trouble. When I fill a list with images, and later clear the list and fill with other contents I can't use the same cached brush IDs because MUI seems to display it from the cache. If I use unique IDs for the new images then the cache is growing unneccessarily.
So maybe a flush cache would be useful if it can be realizable.

Re: Brush in text formatting code may not freed?

Posted: Sat Aug 26, 2017 12:57 pm
by airsoftsoftwair

Code: Select all

- New: Added mui.FreeImage(); this allows you to free an image in MUI Royale's internal image
  cache; you have to pass the number of the brush you want to free or -1 to free all images;
  note that you must make sure that the image you free is no longer used by any widget or MUI
  Royale might crash; note that normally it isn't necessary to call mui.FreeImage() because all
  images are freed automatically when MUI Royale quits; it's only necessary in case you want
  to reuse the same brush number with a new image or free memory used by an image