Friday, 10 May 2024

PlantUML: take memory dump

!dump_memory command dumps the full content of the memory when generating the diagram.

memoryDump.txt

@startuml

!procedure $fib($arg)
	!dump_memory

	!$a = 0
	!$b = 1
	!$counter = 0
	!$fib = 0

	!while $counter < $arg
		#DarkSalmon:for the iteration $counter;
		#palegreen:a=$a, b=$b;

		!$fib = $a + $b
		!$a = $b
		!$b = $fib

		#palegreen:fib=$fib;

		!$counter = $counter + 1

	!endwhile

!endprocedure


start
	$fib(5)
end

@enduml

 

Generate the diagram from above txt file.

 

$java -jar plantuml.jar memoryDump.txt 
[MemLocal] Start of memory_dump 
[MemGlobal] Number of variable(s) : 0
[MemLocal] Number of overriden variable(s) : 1
[MemLocal] $arg = 5
[MemLocal] Number of local variable(s) : 0
[MemGlobal] End of memory_dump

memoryDump.png



 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment