Skip to content

Instantly share code, notes, and snippets.

@pmichaud
Created July 2, 2012 13:41
Show Gist options
  • Select an option

  • Save pmichaud/3033283 to your computer and use it in GitHub Desktop.

Select an option

Save pmichaud/3033283 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/parrot$ ulimit -v
unlimited
pmichaud@kiwi:~/p6/parrot$ ./parrot gc.pir 1 # how much memory do we need for 1 rpa?
gc_mark_runs=0
gc_collect_runs=0
total_pmcs=2040
active_pmcs=1999
total_mem_alloc=663552
total_mem_used=318342
pmichaud@kiwi:~/p6/parrot$ # answer: 318KB
pmichaud@kiwi:~/p6/parrot$ ulimit -Sv 64000 # limit our processes to 64MB
pmichaud@kiwi:~/p6/parrot$ ./parrot gc.pir 1 # see if creating 1 PMC still fits in 64MB, it does
gc_mark_runs=0
gc_collect_runs=0
total_pmcs=2040
active_pmcs=1999
total_mem_alloc=663552
total_mem_used=318342
pmichaud@kiwi:~/p6/parrot$ ./parrot gc.pir 1000000 # see if creating 1million PMCs fits in 64MB
Failed allocation of 4096 bytes
Parrot VM: PANIC: Out of mem!
C file src/gc/alloc_memory.c, line 75
Parrot file (not available), line (not available)
We highly suggest you notify the Parrot team if you have not been working on
Parrot. Use parrotbug (located in parrot's root directory) or send an
e-mail to parrot-dev@lists.parrot.org.
Include the entire text of this error message and the text of the script that
generated the error. If you've made any modifications to Parrot, please
describe them as well.
Version : 4.5.0-devel
Configured : Sun Jul 1 23:16:32 2012 GMT
Architecture: amd64-linux
Interp Flags: (no interpreter)
Exceptions : (missing from core)
Dumping Core...
Sorry, coredump is not yet implemented for this platform.
pmichaud@kiwi:~/p6/parrot$ cat gc.pir
## This program reads a number from the command line,
## then creates that number of RPAs via a loop and reports
## interpinfo memory statistics at the end. The RPAs
## are created with replacement, so that only one RPA
## is actually "alive" at any given time.
.include 'interpinfo.pasm'
.sub 'main' :main
.param pmc args
.local int N
N = args[1]
$I0 = 0
loop:
unless $I0 < N goto done
$P0 = new ['ResizablePMCArray']
inc $I0
goto loop
done:
# Now display the current memory consumption statistics.
print "gc_mark_runs="
$I0 = interpinfo .INTERPINFO_GC_MARK_RUNS
say $I0
print "gc_collect_runs="
$I0 = interpinfo .INTERPINFO_GC_COLLECT_RUNS
say $I0
print "total_pmcs="
$I0 = interpinfo .INTERPINFO_TOTAL_PMCS
say $I0
print "active_pmcs="
$I0 = interpinfo .INTERPINFO_ACTIVE_PMCS
say $I0
print "total_mem_alloc="
$I0 = interpinfo .INTERPINFO_TOTAL_MEM_ALLOC
say $I0
print "total_mem_used="
$I0 = interpinfo .INTERPINFO_TOTAL_MEM_USED
say $I0
.end
pmichaud@kiwi:~/p6/parrot$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment