Brush in text formatting code may not freed?

Discuss GUI programming with the MUI Royale plugin here
Post Reply
User avatar
lazi
Posts: 286
Joined: Fri Feb 25, 2011 12:08 am

Brush in text formatting code may not freed?

Post by lazi » Tue Jul 18, 2017 11:07 pm

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

User avatar
airsoftsoftwair
Posts: 2482
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Brush in text formatting code may not freed?

Post by airsoftsoftwair » Sat Jul 22, 2017 2:31 pm

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.

User avatar
lazi
Posts: 286
Joined: Fri Feb 25, 2011 12:08 am

Re: Brush in text formatting code may not freed?

Post by lazi » Sun Aug 20, 2017 12:04 pm

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.

User avatar
airsoftsoftwair
Posts: 2482
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Brush in text formatting code may not freed?

Post by airsoftsoftwair » Sat Aug 26, 2017 12:57 pm

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

Post Reply