Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1995, 1998 Aladdin Enterprises.  All rights reserved.
2
 
3
  This software is provided AS-IS with no warranty, either express or
4
  implied.
5
 
6
  This software is distributed under license and may not be copied,
7
  modified or distributed except as expressly authorized under the terms
8
  of the license contained in the file LICENSE in this distribution.
9
 
10
  For more information about licensing, please refer to
11
  http://www.ghostscript.com/licensing/. For information on
12
  commercial licensing, go to http://www.artifex.com/licensing/ or
13
  contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
  San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
*/
16
 
17
/* $Id: gsalloc.h,v 1.7 2004/08/04 19:36:12 stefan Exp $ */
18
/* Memory allocator extensions for standard allocator */
19
 
20
#ifndef gsalloc_INCLUDED
21
#  define gsalloc_INCLUDED
22
 
23
/* The following should not be needed at this level! */
24
 
25
#ifndef gs_ref_memory_DEFINED
26
#  define gs_ref_memory_DEFINED
27
typedef struct gs_ref_memory_s gs_ref_memory_t;
28
#endif
29
 
30
/*
31
 * Define a structure and interface for GC-related allocator state.
32
 */
33
typedef struct gs_memory_gc_status_s {
34
	/* Set by client */
35
    long vm_threshold;		/* GC interval */
36
    long max_vm;		/* maximum allowed allocation */
37
    int *psignal;		/* if not NULL, store signal_value */
38
				/* here if we go over the vm_threshold */
39
    int signal_value;		/* value to store in *psignal */
40
    bool enabled;		/* auto GC enabled if true */
41
	/* Set by allocator */
42
    long requested;		/* amount of last failing request */
43
} gs_memory_gc_status_t;
44
void gs_memory_gc_status(const gs_ref_memory_t *, gs_memory_gc_status_t *);
45
void gs_memory_set_gc_status(gs_ref_memory_t *, const gs_memory_gc_status_t *);
46
void gs_memory_set_vm_threshold(gs_ref_memory_t * mem, long val);
47
void gs_memory_set_vm_reclaim(gs_ref_memory_t * mem, bool enabled);
48
 
49
/* ------ Initialization ------ */
50
 
51
/*
52
 * Allocate and mostly initialize the state of an allocator (system, global,
53
 * or local).  Does not initialize global or space.
54
 */
55
gs_ref_memory_t *ialloc_alloc_state(gs_memory_t *, uint);
56
 
57
/*
58
 * Add a chunk to an externally controlled allocator.  Such allocators
59
 * allocate all objects as immovable, are not garbage-collected, and
60
 * don't attempt to acquire additional memory (or free chunks) on their own.
61
 */
62
int ialloc_add_chunk(gs_ref_memory_t *, ulong, client_name_t);
63
 
64
/* ------ Internal routines ------ */
65
 
66
/* Prepare for a GC. */
67
void ialloc_gc_prepare(gs_ref_memory_t *);
68
 
69
/* Initialize after a save. */
70
void ialloc_reset(gs_ref_memory_t *);
71
 
72
/* Initialize after a save or GC. */
73
void ialloc_reset_free(gs_ref_memory_t *);
74
 
75
/* Set the cached allocation limit of an alloctor from its GC parameters. */
76
void ialloc_set_limit(gs_ref_memory_t *);
77
 
78
/* Consolidate free objects. */
79
void ialloc_consolidate_free(gs_ref_memory_t *);
80
 
81
#endif /* gsalloc_INCLUDED */