🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jason Freund Tue, 07 Aug 1990 23:57
Sun Pascal 2.0 array storage
#1
Author: Jason Freund
Date: Tue, 07 Aug 1990 23:57
36 lines
2353 bytes
	I'm writing a program in Sun Pascal V2.0 that uses 1 giant
datastructure to hold the data for the entire program.  For several
reasons, irrelevant to this question, I chose to use only arrays and records.
No recursive datastructures.  At the lower levels of the structure, most
arrays are of type "varying" -- a char array that is alway = '' until you
give it something -- it's never bigger than the string it contains.

	My question is how much memory do various datastructures occupy?
If I have:  (just an analogy of my program.)

paragraphs = array [1..10] of varying;
pages = array [1..5] of paragraphs;
chapter = array [1..20] of pages;
book = array [1..10] of chapters;

How much memory am I wasting?   The varying at the bottom shouldnt be too
much of a problem -- although there are 10*20*5*10 of them, most of them are
empty (nil).  There are 10*20*5 pages -- mostly empty, 10*20 chapters,
mostly empty, etc.  So given that the varyings don't take up too much space and 
everything else is ~50-60% empty, how much memory will I be using, how much am
I wasting?

(PS.  I know that all of the above should be linked lists so that remaining blanks
in the book don't use up memory until they're written, but for now, I don't want
to use LLs -- I may later, but for now, I'm just curious.)

Thanks,
Jason Freund, Sun Microsystems,  jasonf@cetemp.Corp.sun.com  <== summer address
Deprtmnt of Computer Science, Univ California, Davis. freund@sakura.ucdavis.edu
Quantum Link: JasonF5,  Compu$erve: 72007,244, 690 Erie Dr, Sunnyvale, CA 94087
-------------------------------------------------------------------------------
STOLEN QUOTES -- Please give the authors credit if you know who they are!    
"To understand recursion, you need to understand recursion."
"Wow!  Virtual memory!  Now I'm gonna build me a REALLY big ram disk!"
"My other computer is a SUN3/50."  "E. Pluribus UNIX"   -- authors unkown 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads