I have a question about RAM usage.
I'm using a Macintosh G3 tower (300 MHz) with 128 meg RAM and virtual memory
turned on, running OS 8.6.

I've got a stand-alone application created with MetaCard, and I've set the
memory at:
8000K - minimum
8000K - preferred

When I launch the app, then look at the "About this computer" window in the
finder, the Mac says the program is allocated for 10.6 MB, though I only
allocated 8000K.  Hmm.... it would be cool to hear a simply stated
explanation of why this is, for my own info.  Other Mac applications don't
seem to do this, or do they and I never noticed?

Next thing... in the same app, I load a big text file into RAM (about 1.2
meg).  Suddenly the amount of RAM that the app takes up has ballooned from
10.6 MB to a whopping 21.3 MB!  Once the text file is cleared out of RAM,
the RAM usage of the app goes to 20.1 MB, which makes sense... 21.3 - 20.1 =
1.2.  But what's with the rest of the RAM?  Why does it take 10 MB of extra
RAM to read a 1.2 MB file into a global variable?  And why does MetaCard not
give ALL of the RAM back after I clear the variable?

I can surely break the text file up into smaller pieces to load and unload
to avoid this problem, but there will be a speed hit.  If that's what it
takes to keep the app within reasonable RAM usage, so be it... but I was
just curious why this is, and what the deal is with how MetaCard asks for
RAM on the Mac.  I realize I'm inviting a Master's Thesis discussion on RAM
usage, but I'm just a poor ex-HyperCard user with no C++ background and I'm
hoping someone can explain this to me so I can learn something new!

--Richard MacLemale
www.coolclassroom.com 

Reply via email to