# kjs Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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, and collect().

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::ValueImp::mark(), KJS::ValueImp::refcount, and KJS::ValueImp::~ValueImp(). Referenced by allocate(), and KJS::Interpreter::collect().

The documentation for this class was generated from the following files:

- collector.h
- collector.cpp

This file is part of the documentation for kjs Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003