🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13371

Re: Fonts and freeing memory

#13371
From: Richard Addison
Date: Sun, 07 Jan 1990 22:19
31 lines
1900 bytes
In article <2528@jato.Jpl.Nasa.Gov> zupke@jato.Jpl.Nasa.Gov (Brian Zupke (JPL Amiga Club Pres.)) 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
>tried numerous combinations of font functions (even RemFont()) and still
>have this problem.  Does anyone know if there's a bug in the font functions,
>or am I doing something wrong?
>
>Thanks in advance.
>
>--Brian

Well, you don't need to worry about it.  When the system gets low on memory,
it will automagically free the memory that is used for the font.

Now, if you _really_ want to get that memory back immediately, you can
request an impossibly large amount of memory with AllocMem().  This will
flush all unused resources from memory.  (This is one of the main reasons
that the documents keep telling you to close everything you open, so it
can keep track).

But again, I recommend that you avoid doing this.  After all, if your
program (on another one) needs this font again, it will save time if
it doesn't have to reload it.

BTW, try "loadwb -debug" sometime and look for the invisible menu to
the right of 'special'.  See 'flushlibs'?  Don't try "Debug" unless you
have a terminal connected to your serial port.

Richard Addison
Technical Details
Message-ID: <22132@usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!pollux.usc.edu!addison
References: <2528@jato.Jpl.Nasa.Gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!pollux.usc.edu!addison
From: addison@pollux.usc.edu (Richard Addison)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Fonts and freeing memory
Summary: Don't worry
Message-ID: <22132@usc.edu>
Date: 7 Jan 90 22:19:35 GMT
References: <2528@jato.Jpl.Nasa.Gov>
Sender: news@usc.edu
Organization: University of Southern California, Los Angeles, CA
Lines: 31