File Manager
#! /usr/bin/crm
#
# match_isolate_reclaim.crm - test match/isolate memory reclamation
# Copyright 2009 William S. Yerazunis.
# This file is under GPLv3, as described in COPYING.
{
window
output /\nMatch-Isolate reclamation test. If this program doesn't \n/
output /error out, the test is passed. (we allocate about 80 megs, \n/
output /well past the window size, but in small (400K) chunks that\n/
output /alternately are allocated and become reclaimable) \n/
alter (:_dw:) /foo/
isolate (:bytes: :s:)
syscall () (:bytes:) /cat \/usr\/share\/dict\/words/
eval (:s:) /:#:bytes:/
isolate (:startbytes:) //
isolate (:endbytes:) //
isolate (:passes:) /0/
isolate (:flux:) /0/
isolate (:dflux:) /0/
isolate (:b2: :b3:)
isolate (:ihead:) /X/
eval (:startbytes:) /:#:_iso:/
output /OK_IF_SIZE_CHANGES: Size of isolation at start: :*:startbytes:\n/
{
isolate (:b2:) /:*:bytes:/
match (:b3:) /.*/ [:b2:]
eval (:flux:) /:@: :*:flux: + :#:b2::/
match (:bytes:) /./
isolate (:bytes:) /:*:b2:/
eval (:flux:) /:@: :*:flux: + :#:bytes::/
match (:b2:) /./
eval (:passes:) /:@: :*:passes: + 1 :/
# how many passes should we run?
eval /:@: :*:passes: < 10 :/
liaf
}
match (:b3:) /./
eval (:endbytes:) /:#:_iso:/
output /Bytes used per pass: :*:s:\n/
output /Passes done: :*:passes: \n/
output /Total flux through isolation: :*:flux:\n/
output /OK_IF_SIZE_CHANGES: Final isolation size: :*:endbytes: \n/
eval (:dflux:) /:@: :*:endbytes: - :*:startbytes::/
output /OK_IF_LESS_THAN_10: Total growth: :*:dflux:\n/
match [:_iso: 0 1000] (:ihead:) /.*/
# output /HEAD: :*:ihead:\n/
match (:ihead:) /./
{
isolate (:b2:) /:*:bytes:/
match (:b3:) /.*/ [:b2:]
eval (:flux:) /:@: :*:flux: + :#:b2::/
match (:bytes:) /./
isolate (:bytes:) /:*:b2:/
eval (:flux:) /:@: :*:flux: + :#:bytes::/
match (:b2:) /./
eval (:passes:) /:@: :*:passes: + 1 :/
# how many passes should we run?
eval /:@: :*:passes: < 20 :/
liaf
}
match (:b3:) /./
eval (:endbytes:) /:#:_iso:/
output /Bytes used per pass: :*:s:\n/
output /Passes done: :*:passes: \n/
output /Total flux through isolation: :*:flux:\n/
output /OK_IF_SIZE_CHANGES: Final isolation size: :*:endbytes: \n/
eval (:dflux:) /:@: :*:endbytes: - :*:startbytes::/
output /OK_IF_LESS_THAN_20: Total growth: :*:dflux:\n/
match [:_iso: 0 1000] (:ihead:) /.*/
# output /HEAD: :*:ihead:\n/
match (:ihead:) /./
{
isolate (:b2:) /:*:bytes:/
match (:b3:) /.*/ [:b2:]
eval (:flux:) /:@: :*:flux: + :#:b2::/
match (:bytes:) /./
isolate (:bytes:) /:*:b2:/
eval (:flux:) /:@: :*:flux: + :#:bytes::/
match (:b2:) /./
eval (:passes:) /:@: :*:passes: + 1 :/
# how many passes should we run?
eval /:@: :*:passes: < 30 :/
liaf
}
match (:b3:) /./
eval (:endbytes:) /:#:_iso:/
output /Bytes used per pass: :*:s:\n/
output /Passes done: :*:passes: \n/
output /Total flux through isolation: :*:flux:\n/
output /OK_IF_SIZE_CHANGES: Final isolation size: :*:endbytes: \n/
eval (:dflux:) /:@: :*:endbytes: - :*:startbytes::/
output /OK_IF_LESS_THAN_30: Total growth: :*:dflux:\n/
match [:_iso: 0 1000] (:ihead:) /.*/
# output /HEAD: :*:ihead:\n/
match (:ihead:) /./
{
isolate (:b2:) /:*:bytes:/
match (:b3:) /.*/ [:b2:]
eval (:flux:) /:@: :*:flux: + :#:b2::/
match (:bytes:) /./
isolate (:bytes:) /:*:b2:/
eval (:flux:) /:@: :*:flux: + :#:bytes::/
match (:b2:) /./
eval (:passes:) /:@: :*:passes: + 1 :/
# how many passes should we run?
eval /:@: :*:passes: < 40 :/
liaf
}
match (:b3:) /./
eval (:endbytes:) /:#:_iso:/
output /Bytes used per pass: :*:s:\n/
output /Passes done: :*:passes: \n/
output /Total flux through isolation: :*:flux:\n/
output /OK_IF_SIZE_CHANGES: Final isolation size: :*:endbytes: \n/
eval (:flux:) /:@: :*:endbytes: - :*:startbytes::/
output /OK_IF_LESS_THAN_40: Total growth: :*:flux:\n/
match [:_iso: 0 1000] (:ihead:) /.*/
# output /HEAD: :*:ihead:\n/
match (:ihead:) /./
}
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com