[M3devel] Calling RTHeapStats.ReportReachable(); with Pthread cvs head
Tony Hosking
hosking at cs.purdue.edu
Mon Oct 22 16:09:08 CEST 2007
Please try the latest CVS head.
On Oct 21, 2007, at 6:03 PM, Daniel Alejandro Benavides D. wrote:
> Hi:
> Im trying to execute the following program with the Pthread cvs
> head implementation and I got this when executing the program:
>
> danielb at danielb-desktop:~/as207/code/m3gdb$ LINUXLIBC6/Main
> Entre dos enteros6 7
> Estadisticas del Heap
> HEAP: 0xb73d2000 .. 0xb7412000 => 0.2 Mbytes
>
>
> ***
> *** runtime error:
> *** <*ASSERT*> failed.
> *** file "../src/thread/PTHREAD/ThreadPThread.m3", line 992
> ***
>
> Aborted
> danielb at danielb-desktop:~/as207/code/m3gdb$
>
> The assert violated in m3core/thread/PTHREAD/ThreadPthread.m3 is this:
> PROCEDURE ProcessOther (act: Activation; p: PROCEDURE (start,
> stop: ADDRESS)) =
> (* LL=activeMu *)
> VAR
> sp: ADDRESS;
> state: RTMachine.ThreadState;
> BEGIN
> <*ASSERT act.state = ActState.Stopped*>
>
>
> The source code of the little program is this:
>
> MODULE Main;
>
> IMPORT SIO;
> IMPORT RTHeapStats;
> IMPORT RTutils;
> IMPORT RTHeapDebug;
> VAR
> varA, varB, varC: INTEGER;
>
>
> PROCEDURE multiplicar(a,b: INTEGER): INTEGER=
> VAR
> varC: INTEGER;
> BEGIN
> varC:=a*b;
> RETURN varC;
> END multiplicar;
>
>
> BEGIN
>
> SIO.PutText("Entre dos enteros");
> varA:=SIO.GetInt();
> varB:=SIO.GetInt();
> varC:=multiplicar(varA,varB);
> SIO.PutText("Estadisticas del Heap");
> RTHeapDebug.CheckHeap();
> RTHeapStats.ReportReachable();
> (* RTutils.Heap
> (FALSE,RTutils.HeapPresentation.ByTypecode,TRUE,LAST(CARDINAL));*)
> SIO.PutInt(varC);
>
> END Main.
>
> According to the draft book of Michael Dagenais Building
> Distributed OO Applications: Modula-3 Objects at Work,
> RTHeapStats.ReportReachable()
> " ... is called to determine the number
> of active, reachable, objects (i.e. those which would not be
> garbage collected). Of the 1980 objects on the heap, only slightly
> more than half are still alive."
>
> According to the interface documentation:
> "reports the number of reachable objects and bytes from each
> compilation unit, thread stack, and the individual roots that reach
> the most bytes. The report is written to stderr. The Modula-3
> process is frozen during the scanning and reporting."
>
> Obviously with the previous version of pthread the things were
> working fine, also with user level implementation
>
> Thanks,
>
> Daniel Benavides
>
>
> Sé un Mejor Amante del Cine
> ¿Quieres saber cómo? ¡Deja que otras personas te ayuden! .
More information about the M3devel
mailing list