Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!snorkelwacker!ira.uka.de!smurf!ccave!root From: root@ccave.UUCP (Juergen Hermann) Newsgroups: comp.sys.amiga.tech Subject: Re: Fonts and freeing memory Message-ID: <145@ccave.UUCP> Date: 9 Jan 90 03:21:25 GMT References: <2528@jato.Jpl.Nasa.Gov> Reply-To: root@ccave.UUCP (Juergen Hermann) Organization: Chameleon's Cave [JDCP 0.96] Lines: 20 In article <2528@jato.Jpl.Nasa.Gov> zupke@jato.Jpl.Nasa.Gov (Brian Zupke ) writes: >Howdy! I'm working on a C program that loads a font from disk using >OpenDiskFont(), uses it with SetFont(), and then gets rid of it later with >CloseFont(). My problem is that each time I run my program, I lose around >3k-4k bytes of memory (very close to the size of the font on disk). I've You MUST use OpenFont() to look for resident fonts before ever calling OpenDiskFont(). If not, the font is made resident over and over again, in fact loosing memory for nothing. So do something like if ((WinFont = (struct TextFont *) OpenFont (&ta)) == NULL && (WinFont = (struct TextFont *) OpenDiskFont (&ta)) == NULL) { Abort ("Can't open font\n"); } -- // Juergen Hermann UUCP: ira.uka.de!smurf!ccave!root \X/ 75 Karlsruhe 1, FRG Fido: 2:241/2.1212@FidoNet