((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/heap-o-rama" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg") (toc)) (section 2 "heap-o-rama" (section 3 "Introduction" (p "Filter the heap after a major garbage collection for objects of a particular type.")) (section 3 "Usage" (highlight scheme "(require-extension heap-o-rama)")) (section 3 "Requirements" (p "This extension runs only on CHICKEN 4.5.7 or newer.")) (section 3 "Documentation" (section 4 "setup-low-level-stuff" (def (sig (procedure "(setup-low-level-stuff MINSIZE MAXSIZE)" (id setup-low-level-stuff))) (p "Sets up a " (i "GC hook") " that records whether a major garbage collection has been performed. Any previously installed hooks are retained. " (tt "MINSIZE") " and " (tt "MAXSIZE") " specify the minimum and maximum size of objects (in elements) that should be extracted from the heap."))) (section 4 "gc-happened?" (def (sig (procedure "(gc-happened?)" (id gc-happened?))) (p "Returns true if a major GC was triggered after the last call to " (tt "do-the-dance") " (see below)."))) (section 4 "do-the-dance" (def (sig (procedure "(do-the-dance COUNT PROTOS)" (id do-the-dance))) (p "Performs another major garbage collection and collects at most " (tt "COUNT") " non-immediate objects still live on the heap after the collection. " (tt "PROTOS") " should be a vector of prototype objects - live objects in the heap that are of identical type are collected and returned.  Structure objects (\"records\") in " (tt "PROTOS") " specify record objects that should be matched.") (p "Returns 3 values: the \"object vector\", the \"link table\" and a count of how many objects are stored in the object vector and link table, respectively.") (p "The object vector holds the actual objects filtered from the heap. The link table contains sub-vectors of the form " (tt "#(LINKCOUNT LINKINDEX1 ...)") " where " (tt "LINKCOUNT") " gives the number of links between the object at the same index in the object vector and " (tt "LINKINDEX1 ...") " gives the index of objects that where filtered and who are references by that object. The sub-vector may hold additional elements of value " (tt "#f") " and has the same size as the filtered object.") (p "Note that this procedure does very little error checking.")))) (section 3 "Author" (p (int-link "/users/felix winkelmann" "Felix Winkelmann"))) (section 3 "License" (pre "Copyright (c) 2010, Felix L. Winkelmann\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n3. The name of the authors may not be used to endorse or promote products\n   derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n ")) (section 3 "Version History" (dl (dt "0.1") (dd "initial release")))))