# kjs Library API Documentation

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

# KJS::Collector Class Reference

Garbage collector. More...

`#include <collector.h>`

List of all members.

## Static Public Member Functions

void * | allocate (size_t s)
| Register an object with the collector.
bool | collect ()
| Run the garbage collection.
int | size ()
bool | outOfMemory ()

## Detailed Description

Garbage collector.

Definition at line 59 of file collector.h.

## Member Function Documentation

void * 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 75 of file collector.cpp.

References collect().

bool Collector::collect | ( |  | ) | `[static]`

| Run the garbage collection. This involves calling the delete operator on each object and freeing the used memory. Definition at line 140 of file collector.cpp. References KJS::ValueImp::_flags, KJS::ValueImp::mark(), KStdAccel::next(), KJS::ValueImp::refcount, and KJS::ValueImp::~ValueImp(). Referenced by allocate().

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

- collector.h
- collector.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:08:41 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001