I'm fighting a now-you-see-it now-you-don't kind of bug and I was wondering 
if there's a way to completely turn off garbage collection and memory 
re-use for debugging?

My problems vanish when seemingly insignificant things happen, and 
re-appear again later.  For example, I'll take a line of text (simplified):

           save S0               #  "20 GOTO 10"
           bsr TOKENIZER
        restore I5
        save VARWIDTH  # (10)
        save " "
        bsr PAD
        restore S1
        dec I5
        concat S22, S1                     # S22 is now "20        "
           concat S22, S0
        concat S22, TERMINATOR    # S22 now reads "20        20 GOTO 10#"
        bsr CLEAR                           # Clean stack

Much later on, I'll look in S22 and find that the part that once read as it 
did above, now reads:

            "20                   #"

With the in-between text...vanished.  Sometimes adding a diagnostic "print" 
statement makes it go away.  Sometimes adding two makes it come back 
again.  Having the interpreter handle some programs makes everything fine 
but just jumping in and loading WUMPUS right away makes it die.

I'm completely positive I'm not clearing that piece of real 
estate...something else is doing it. But what, I dunno.  Why, I know even less.

[This causes the occasional "wrong type on stack" errors in BASIC.  I get 
the error because I pull the line from S22 (which is now nothing but 
spaces) and attempt to extract the line number from it... and fail.  This 
is really a Should Not Happen error because the line number was verified 
(in the real code) as it was stuck into S22.  This can happen during a LOAD 
or RUN on typed-in programs where S22 gets populated.  To see for yourself, 
start parrot basic and immediately type (and nothing else, no typos):

        10 PRINT "HELLO WORLD"
           20 GOTO 10
           LIST

And the listing will have a blank line 20 under Win32, recent builds of 
parrot.  If you type an empty line anywhere in this process (just a return) 
or any other keywords after the Ready prompt the problem goes away magically.]

Reply via email to