Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.development.apps > #638

memory use

From Bob Tennent <BobT@cs.queensu.ca>
Newsgroups comp.os.linux.development.apps
Subject memory use
Date 2011-02-02 18:02 +0000
Organization albasani.net
Message-ID <slrnikj71n.9i7.BobT@linus.cs.queensu.ca> (permalink)

Show all headers | View raw


A C program called musixflx is used as the second pass of a
three-pass TeX-based system called musixtex.  The program was
the first C program written by a Fortran programmer.  It has
definitions as follows:

  # define MAX_BARS    2048  /* max number of bars */

  int zbar[MAX_BARS], lr_repeat[MAX_BARS], raggedline[MAX_BARS],
      l_repeat[MAX_BARS], barno[MAX_BARS], ...

  double hardbarlength[MAX_BARS], softbarlength[MAX_BARS],
         width_leftrightrepeat[MAX_BARS], width_leftrepeat[MAX_BARS],
         ...

Typically the number of bars in a piece is much smaller than MAX_BARS.

Would it be best to

 + leave the code alone and let the virtual-memory functions of the
   operating system manage the memory

 + use "extensible" arrays (i.e., use realloc to copy small arrays to
   larger ones when necessary)

And would there be any benefit to using a single array of structures
instead of many parallel arrays?

Bob T.

Back to comp.os.linux.development.apps | Previous | Next | Find similar


Thread

memory use Bob Tennent <BobT@cs.queensu.ca> - 2011-02-02 18:02 +0000

csiph-web