kjs Library API Documentation

KJS::Collector Class Reference

Garbage collector. More...

#include <collector.h>

List of all members.

Static Public Member Functions

static void * allocate (size_t s)
static bool collect ()
static int size ()
static bool outOfMemory ()


Detailed Description

Garbage collector.

Definition at line 38 of file collector.h.


Member Function Documentation

void * KJS::Collector::allocate size_t  s  )  [static]
 

Register an object with the collector.

The following assumptions are made:

  • the operator new() of the object class is overloaded.
  • operator delete() has been overloaded as well and does not free the memory on its own.
Parameters:
s Size of the memory to be registered.
Returns:
A pointer to the allocated memory.

Definition at line 82 of file collector.cpp.

References KJS::ValueImp::_vd, KJS::ALLOCATIONS_PER_COLLECTION, KJS::CELL_SIZE, KJS::CELLS_PER_BLOCK, collect(), KJS::GROWTH_FACTOR, KJS::heap, and KJS::MIN_ARRAY_SIZE.

Referenced by KJS::ValueImp::operator new().

bool KJS::Collector::collect  )  [static]
 

Run the garbage collection.

This involves calling the delete operator on each object and freeing the used memory.

Definition at line 157 of file collector.cpp.

References KJS::ValueImp::_flags, KJS::ValueImp::_vd, KJS::CELLS_PER_BLOCK, KJS::GROWTH_FACTOR, KJS::heap, KJS::LOW_WATER_FACTOR, KJS::ValueImp::mark(), KJS::InterpreterImp::mark(), KJS::MIN_ARRAY_SIZE, KJS::InterpreterImp::next, KJS::ValueImp::refcount, KJS::SPARE_EMPTY_BLOCKS, and KJS::ValueImp::~ValueImp().

Referenced by allocate(), and KJS::Interpreter::collect().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kjs Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Jun 12 11:32:48 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003