[Oberon] PO2013 - Show Heap Blocks

Tomas Kral thomas.kral at email.cz
Tue Jun 23 11:53:39 CEST 2020


On Tue, 23 Jun 2020 09:46:36 +0100
Paul Reed <paulreed at paddedcell.com> wrote:

> Each free block which is added to the list is added at the front
> (head) of the list, and its next pointer points to the rest of the
> list (which may be NIL)

Yes, above is clear.

  PROCEDURE GetBlock32(VAR p: LONGINT);
    CONST nil = 0;
    VAR q: LONGINT;
  BEGIN
    IF list3 # nil THEN p := list3; (*next*) SYSTEM.GET(list3+8, list3)
    ELSE GetBlock64(q); (*list3 := nil*) SYSTEM.PUT(q+40, nil) END
  END GetBlock32;

What I see happening is, IF list3 # NIL THEN (*next*) list3 := tag (*of a used record*)
tag 146F0H belongs to TextFrames

 0006CBA0   000146F0 00000000 00000001
 00000001   E70071F8 00000000 00000000 <== terminates list3

Running this, will dump similar to the above on occasions list3#0

  PROCEDURE List32*;
  VAR p, q: INTEGER;
  BEGIN
    p := S.ADR(Kernel.MemLim);
    S.GET(p+20, q); (*32*);
    WHILE q # 0 DO
      Out.Hex(q); S.GET(q+4, p); Out.Hex(p); S.GET(q+8, p); Out.Hex(p); Out.Ln;
      S.GET(q+8, q) (*next*)
    END
  END List32;

Using Tools.Inspect I can traverse some parts of the list,
but as heap is very dynamic, it changes while looking at it.

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list