[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: memory use



** Reply to message from "Francisco A. Barrau"  on Thu, 26
Jun 2003 22:19:00 -0000

Francisco:

> when you say
>> keep total file size to under, say, 6-7Kb
> you must include only the running program in each moment, or you have to
> include into the account the programs called (sometimes twice or 3 times
> each one) from the main program (by BC run x.prg XC or  previously load
> by  or by BC ldpm x.pm,a) and exit via , going back to the
> main program.

Good question. There's an amazing array of stuff in that Program buffer. You
can get the total size of it with , you can get a rather uninformative
summary of the contents with DLG frame MACRODIAG, and you can get a much more
informative summary (with the first 78 bytes of each S/G) with U2 frame
LISTSAVS or with U2 frame SGDIAG (the latter may or may not be in v114, but is
definitely in v115). Some of the contents strike me as almost arbitrary: for
example, the list of names assigned to keys ("Enter", "Escape", etc) is in
there, but not the KBD file itself, nor the list of PRNs that could be
activated with SETP, nor any number of other things.

The main components are these:
all extended S/Gs 100-1999 that have been initialized (even if they have no
content)
all initialized ordinary S/Gs 0-9,A-Z (hence anything LDPMed is definitely
there, permanently or until UNLOADed or overwritten)
all initialized &0-&9, &A-&Z programming S/Gs
the entire contents of the last program RUN
the entire contents of the last menu frame executed (DLG, U2, etc), and
sometimes the last three or four of these frames
etc -- oh, the last Copy/Move text -- hell there's a bunch of stuff kept in the
buffer. It absolutely includes much much more than just the currently
executing code...

So: the statement about keeping file size to under 6-7Kb is a *very* loose
rule of thumb. If you haven't got much in your buffer you could go to maybe
12-14Kb. But the max for the whole buffer is around 26-28Kb, and if you exceed
that -- bye bye XyWrite (really bizarre behavior). Gotta quit and relaunch.

> Are there difference in memory used account between  and BC run
> x.prg (when x.prg contains the same --xxxx--)? I think that speed is
> penalized in the second hipotesis but it may be used as a kind of .dll to
> be used by others main programs.

It depends. The RUN program will stay in the buffer until replaced by another
RUN-style program.  could be wiped out () or even de-initialized
(by a U2 program called ClearSgts -- something I don't think can be done
natively in XyWrite) before the program concludes, which means that S/G A
wouldn't be holding a lot of data that does nothing. OTOH, like DLLs, any
extended or ordinary S/G can of course hang around as a sort of subroutine that
other programs could call at any time -- on my system, this happens all the
time.

I have a little program called KILLMEM.PM, which i RUN from time to time when
I'm programming and VA$M+6 starts to get perilously close to the edge. KILLMEM
wipes a lot of the so-called "special" Save/Gets that are given, by MACRODIAG,
hexadecimal names, but which also have decimal names (e.g. S/G *3613 in
MACRODIAG is the same as S/G 13843, and you can view the beginning of it with
). Needless to say, there is ZERO documentation for any of this
stuff. My own understanding of them is very partial, and I would love to know
more about them -- like, for example, whether they could be overwritten with
some "secret" XPL method. Or, for example, whether there is any method to get
the current text of a displayed PRompt into a S/G... gosh that would be
helpful.

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------