[comp.sys.handhelds] Mysterious partial loss of 48SX memory

bill@videovax.tv.tek.com (William K. McFadden) (07/30/90)

Something very strange just happened to my 48.  I was using a program that
works with a 7K byte object (a list of names and addresses).  At the time, I
had about 10K bytes free, enough to store another copy of the object.  At one
point, I got an "Insufficient Memory" error.  On checking, I had only 3K of
free memory!  I also noticed the alarm annunciator going on and off in the
display, so I cycled power.  "Low Battery Warning."

I replaced the batteries, but still had only 3K available.  So, I went through
the entire machine, and found I was only using 20K of memory.  I only had a few
alarms and key assignments, so I knew that wasn't it.  I had no libraries
attached, either.

Finally, as a last resort, I ran the diagnostic test shown in the appendix of
the manual.  Everything checked okay.  I stopped the test and discovered I had
the entire 10K again.  Whew!

Speculation:  I believe the low battery condition somehow left a copy of the 7K
object in memory that wasn't properly garbage collected.  Running the
diagnostic (or perhaps the reset which terminated the diagnostic) caused the
memory to be reclaimed.

Comments?
-- 
Bill McFadden    Tektronix, Inc.  P.O. Box 500  MS 58-639  Beaverton, OR  97077
bill@videovax.tv.tek.com,     {hplabs,uw-beaver,decvax}!tektronix!videovax!bill
Phone: (503) 627-6920       "The biggest difference between developing a missle
component and a toy is the 'cost constraint.'" -- John Anderson, Engineer, TI

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (07/31/90)

 
|> Something very strange just happened to my 48.  I was using a program that
|> works with a 7K byte object (a list of names and addresses).  At the time, I
|> had about 10K bytes free, enough to store another copy of the object.  At
one
|> point, I got an "Insufficient Memory" error.  On checking, I had only 3K of
|> free memory! 

The calculator may have extra copies of objects in various circumstances --
stored in the "last stack" area, et cetera.  Next time something like the above
happens, try a system reset (On/C) and then MEM.


				-- edp

umapd51@sund.cc.ic.ac.uk (W.A.C. Mier-Jedrzejowicz) (08/01/90)

Bill McFadden worries that he had only 3k of HP48 memory left when he
was using a 7k object and should have had 10k left. The most likely
explanation then is that a spare copy of the 7k object was lurking
around somewhere. Now, the HP48 keeps spare copies of things in the LAST
STK, LAST ARG and LAST CMD areas. That could be up to 3 copies of the
object! When Bill did a self-test, the full 10k returned. That's
obvious, the stack and the LAST everything areas are cleared out during
a self-test, so the spare copy, wherever it was, got cleared out. All is
explained, unless Bill is sure that he had LAST STK, LAST ARG and LAST
CMD disabled - did you, Bill?
As for the low battery message,  I'd say that was purely coincidental,
since the above explains the missing 7k completely.
Moral: be aware that the LAST options can take up a great deal of memory
in the HP 48SX. Be careful though before disabling them, as it can cost
you an awful lot of effort recreating something because you disabled all
these options.
Wlodek Mier-Jedrzejowicz, Space & Atmospheric Physics, Imperial College,
London.
DISCLAIMER: On this occasion my HP48 shares my opinion, but neither my
employer nor HP even know about it.

bill@videovax.tv.tek.com (William K. McFadden) (08/02/90)

Thanks for the replies regarding the mysterious memory loss.  As for the
concerns about having LAST STACK and LAST ARG turned on, turning them off made
no difference.  I thought the 48 just stored a copy of the pointers to an
object (instead of storing a copy of the object) until you modified one of the
copies.  There should have been enough memory to put a copy of my 7K object on
the stack for use by my program.  (BTW, before someone asks, I didn't have
anything on the stack before I ran the program.)

The one thing I didn't try was turning off LAST CMD, but I thought this only
repeated the last operation.  What exactly gets saved?

I'm still convinced the calculator lost track of the memory because the program
works fine now, even with LAST * turned on.  (It also worked fine up until I
got the "Insufficient Memory" error.)
-- 
Bill McFadden    Tektronix, Inc.  P.O. Box 500  MS 58-639  Beaverton, OR  97077
bill@videovax.tv.tek.com,     {hplabs,uw-beaver,decvax}!tektronix!videovax!bill
Phone: (503) 627-6920       "The biggest difference between developing a missle
component and a toy is the 'cost constraint.'" -- John Anderson, Engineer, TI

billw@hpcvra.CV.HP.COM (William C Wickes) (08/03/90)

The HP 48SX LAST CMD stack saves the last four command line strings.  Each
string is distinct from the object(s) generated upon ENTER, and is typically
comparable in size to the object(s).

There is no conceivable way in which a low battery detect can cause the
OS to lose track of an object--if there's enough voltage to run, it runs.
There could of course be a software bug that caused the apparent loss of
memory, but to date, EVERY such occurrence reported has been accounted
for by one of the normal mechanisms such as Wlodek describes.