Managing ObjectStore
osgc: Garbage Collection Utility
Garbage collection frees storage associated with persistent objects that are unreachable. Applications can continue to use a database while garbage collection is in process.
The command-line utility for collecting garbage is osgc. Invoke this tool with the following format:
Syntax
osgc [ options ] database_name
Options
Performing Garbage Collection in a Database
The ObjectStore persistent garbage collector (GC) collects unreferenced objects and ObjectStore collections in an ObjectStore database.
Persistent garbage collection frees storage associated with objects that are unreachable. It does not move remaining objects to coalesce the free space. (See oscompact: Compacting Databases.)
The GC performs its job in two major phases. In the mark phase, the GC identifies the unreachable objects. In the sweep phase, the GC frees the storage used by the unreachable objects.
A segment is the smallest storage unit that can be garbage collected. You can specify a segment or a database to be garbage collected.
C++ usage note
Normally, databases resulting from ObjectStore applications written in C++ do not require garbage collection because all storage allocation is handled explicitly.
osgc can be useful as a debugging tool. For example, if unreferenced objects are being harvested, it is an indication of a persistent memory leak. The identity of these objects can be a clue to the root of the problem.
Restriction
If your application relies on intersegment or interdatabase pointers, you should use segments and databases with the segment reference policy of objectore::export_id_access_required. Otherwise, references to one database from another will not be detected by osgc and objects pointed to by references from other databases will be seen as unreferenced and, therefore, removed.
Applications can continue to use a database while persistent GC is in progress. GC locks portions of a segment as needed, as if it were just another application. In this way, the GC minimizes the number of pages that are locked and the duration for which the locks are held. Also, the GC retries operations when it detects lock conflicts.
By default, the GC runs with a transaction priority of zero. Consequently, it is the preferred victim when the Server must terminate a transaction to resolve a deadlock. At a later time, the GC redoes the work that was lost when the transaction was aborted.
The GC uses read- and write-lock timeouts of short duration. This avoids competition with other processes for locks. If the GC cannot acquire a lock because of a timeout, it retries the operation at a later time.
[previous] [next]
Copyright © 1999 Object Design, Inc. All rights
reserved.
Updated: 03/11/99 11:19:07