![]() |
![]() |
#1 |
Registered User
Join Date: May 2019
Location: Finland
Posts: 13
|
AMCAF Fonts Bug?
Hi.
Have you noticed this kind of bug in Amcaf? Text bank change seems to eat all the memory . First fast, then chip. I have hud, where I like to use different sizes of fonts, so I change the bank in main loop. This problem does not exist, in some winuae configurations. But in real Amiga 1200 + 4mb (and Winuae, with similar config) it happends. How can it be avoided? Here's code to test: Screen Open 0,320,256,2,Lowres Curs Off : Colour 1,$FFF Make Bank Font 7 Change Font "ruby.font",8 Make Bank Font 8 Repeat Change Bank Font 7 Text 10,10,"Chip:"+Str$(Chip Free)+" " Change Bank Font 8 Text 10,20,"Fast:"+Str$(Fast Free)+" " Until Mouse Click |
![]() |
![]() |
#2 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 91
|
Hey, it's leaking my memory too!
![]() Like you I am using Change Bank Font frequently in the project I'm currently working on, so this problem is relevant for me as well. Incredible find @Mikket ![]() |
![]() |
![]() |
#3 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
No idea but what is you Erase 7 etc or Erase All etc does it make a difference?
|
![]() |
![]() |
#4 | |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 91
|
Lucky me! I found a way to plug the leak
![]() Quote:
I went over to the SetFont docs, and found in the BUGS section that this function is known to have a memory leak problem, starting from kickstart V36 (which according to wikipedia means starting with the A500+ model). It further suggests using StripFont to solve the problem, and this appears to work. The following instructions will call StripFont with the required arguments: Code:
Areg(0)=Leek(Scrn Rastport+52) : RESULT=Gfxcall(-822) |
|
![]() |
![]() |
#5 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
![]() |
![]() |
![]() |
#6 |
Registered User
Join Date: May 2019
Location: Finland
Posts: 13
|
Great, that you found this fix adrazar. I had to transfer one font to icons, but now i can change back to amcaf font bank. Thanks.
|
![]() |
![]() |
#7 | |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 91
|
Quote:
Another thing I found while testing is that if the same bank font is used in two different screens at the same time, then StripFont can restore the memory for only one of them. So to avoid memory leak, one must see to it that two screens never share the same bank font. Achieving this turns out to be a bit tricky, but I've nevertheless managed to concoct a strategy which I'm reasonably satisfied with: First, for simplicity I try to invariantly make it so that at all times at most one screen has a bank font assigned to it (this was already more or less the case in my program). Second, to return to the default amos font I created this procedure: Code:
AMOSFONT=Leek(Scrn Rastport+52) Global AMOSFONT Procedure RESETFONT ' Avoid calling StripFont on the default font If Leek(Scrn Rastport+52)=AMOSFONT Then Pop Proc ' Call StripFont Areg(0)=Leek(Scrn Rastport+52) RESULT=Gfxcall(-822) ' Restore the default font Loke Scrn Rastport+52,AMOSFONT Doke Scrn Rastport+62,6 : Rem <- value returned by Text Base End Proc ![]() Last edited by adrazar; Yesterday at 10:30. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing Fonts Using AMCAF | DrkStarr | Coders. AMOS | 8 | 17 July 2023 15:04 |
WinUae 4.4.0 - Action replay bug/ Load Config bug | Dan | support.WinUAE | 2 | 20 July 2020 07:59 |
Bug in x64 file requester and bug in Blizzard PPC ROM filesize | headkase | support.WinUAE | 5 | 26 June 2016 14:17 |
Fonts | GordonM | support.WinUAE | 8 | 04 May 2016 18:20 |
Fonts | alkis21 | request.Apps | 2 | 23 August 2002 09:33 |
|
|