/[eiffelstudio]/trunk/eweasel/tests/ccomp040/memory.e
ViewVC logotype

Contents of /trunk/eweasel/tests/ccomp040/memory.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 65297 - (show annotations)
Thu Nov 30 20:22:33 2006 UTC (13 years ago) by manus
File size: 7910 byte(s)
Moved from trunk/Src/eweasel to trunk/eweasel so that a simple checkout of the source code is not penalized by the lenghty process of checking out all the tests of eweasel.
1 indexing
2
3 description: "[
4 Facilities for tuning up the garbage collection mechanism.
5 This class may be used as ancestor by classes needing its facilities.
6 ]"
7
8 status: "See notice at end of class"
9 date: "$Date$"
10 revision: "$Revision$"
11
12 class MEMORY inherit
13
14 MEM_CONST
15
16 feature -- Measurement
17
18 memory_statistics (memory_type: INTEGER): MEM_INFO is
19 -- Memory usage information for `memory_type'
20 require
21 type_ok:
22 memory_type = Total_memory or
23 memory_type = Eiffel_memory or
24 memory_type = C_memory
25 do
26 create Result.make (memory_type)
27 end
28
29 gc_statistics (collector_type: INTEGER): GC_INFO is
30 -- Garbage collection information for `collector_type'.
31 require
32 type_ok:
33 collector_type = Full_collector or
34 collector_type = Incremental_collector
35 do
36 create Result.make (collector_type)
37 end
38
39 feature -- Status report
40
41 is_in_final_collect: BOOLEAN is
42 -- Is GC currently performing final collection
43 -- after execution of current program?
44 -- Safe to use in `dispose'.
45 do
46 check
47 False
48 end
49 end
50
51 memory_threshold: INTEGER is
52 -- Minimum amount of bytes to be allocated before
53 -- starting an automatic garbage collection.
54 do
55 check
56 False
57 end
58 end
59
60 collection_period: INTEGER is
61 -- Period of full collection.
62 -- If the environment variable EIF_FULL_COLLECTION_PERIOD
63 -- is defined, it is set to the closest reasonable
64 -- value from it.
65 -- If null, no full collection is launched.
66 do
67 check
68 False
69 end
70 end
71
72 coalesce_period: INTEGER is
73 -- Period of full coalesce (in number of collections)
74 -- If the environment variable EIF_FULL_COALESCE_PERIOD
75 -- is defined, it is set to the closest reasonable
76 -- value from it.
77 -- If null, no full coalescing is launched.
78 do
79 check
80 False
81 end
82 end
83
84 collecting: BOOLEAN is
85 -- Is garbage collection enabled?
86 do
87 check
88 False
89 end
90 end
91
92 largest_coalesced_block: INTEGER is
93 -- Size of largest coalesced block since last call to
94 -- `largest_coalesced'; 0 if none.
95 do
96 check
97 False
98 end
99 end
100
101 max_mem: INTEGER is
102 -- Maximum amount of bytes the run-time can allocate.
103 do
104 check
105 False
106 end
107 end
108
109 chunk_size: INTEGER is
110 -- Minimal size of a memory chunk. The run-time always
111 -- allocates a multiple of this size.
112 -- If the environment variable EIF_MEMORY_CHUNK
113 -- is defined, it is set to the closest reasonable
114 -- value from it.
115 do
116 check
117 False
118 end
119 end
120
121 tenure: INTEGER is
122 -- Maximum age of object before being considered
123 -- as old (old objects are not scanned during
124 -- partial collection).
125 -- If the environment variable EIF_TENURE_MAX
126 -- is defined, it is set to the closest reasonable
127 -- value from it.
128 do
129 check
130 False
131 end
132 end
133
134 generation_object_limit: INTEGER is
135 -- Maximum size of object in generational scavenge zone.
136 -- If the environment variable EIF_GS_LIMIT
137 -- is defined, it is set to the closest reasonable
138 -- value from it.
139 do
140 check
141 False
142 end
143 end
144
145 scavenge_zone_size: INTEGER is
146 -- Size of generational scavenge zone.
147 -- If the environment variable EIF_MEMORY_SCAVENGE
148 -- is defined, it is set to the closest reasonable
149 -- value from it.
150 do
151 check
152 False
153 end
154 end
155
156 feature -- Status report
157
158 referers (an_object: ANY): ARRAY [ANY] is
159 -- Objects that refer to `an_object'.
160 do
161 check
162 False
163 end
164 end
165
166 feature -- Status setting
167
168 collection_off is
169 -- Disable garbage collection.
170 do
171 check
172 False
173 end
174 end
175
176 collection_on is
177 -- Enable garbage collection.
178 do
179 check
180 False
181 end
182 end
183
184 allocate_fast is
185 -- Enter ``speed'' mode: will optimize speed of memory
186 -- allocation rather than memory usage.
187 do
188 check
189 False
190 end
191 end
192
193 allocate_compact is
194 -- Enter ``memory'' mode: will try to compact memory
195 -- before requesting more from the operating system.
196 do
197 check
198 False
199 end
200 end
201
202 allocate_tiny is
203 -- Enter ``tiny'' mode: will enter ``memory'' mode
204 -- after having freed as much memory as possible.
205 do
206 check
207 False
208 end
209 end
210
211 enable_time_accounting is
212 -- Enable GC time accouting, accessible in `gc_statistics'.
213 do
214 gc_monitoring (True)
215 end
216
217 disable_time_accounting is
218 -- Disable GC time accounting (default).
219 do
220 gc_monitoring (False)
221 end
222
223 set_memory_threshold (value: INTEGER) is
224 -- Set a new `memory_threshold' in bytes. Whenever the memory
225 -- allocated for Eiffel reaches this value, an automatic
226 -- collection is performed.
227 require
228 positive_value: value > 0
229 do
230 check
231 False
232 end
233 end
234
235 set_collection_period (value: INTEGER) is
236 -- Set `collection_period'. Every `value' collection,
237 -- the Garbage collector will perform a collection
238 -- on the whole memory (full collection), otherwise
239 -- a simple partial collection is done.
240 require
241 positive_value: value >= 0
242 do
243 check
244 False
245 end
246 end
247
248 set_coalesce_period (value: INTEGER) is
249 -- Set `coalesce_period'. Every `value' collection,
250 -- the Garbage Collector will coalesce
251 -- the whole memory.
252 require
253 positive_value: value >= 0
254 do
255 check
256 False
257 end
258 end
259
260 set_max_mem (value: INTEGER) is
261 -- Set the maximum amount of memory the run-time can allocate.
262 require
263 positive_value: value > 0
264 do
265 check
266 False
267 end
268 end
269
270 feature -- Removal
271
272 dispose is
273 -- Action to be executed just before garbage collection
274 -- reclaims an object.
275 -- Default version does nothing; redefine in descendants
276 -- to perform specific dispose actions. Those actions
277 -- should only take care of freeing external resources;
278 -- they should not perform remote calls on other objects
279 -- since these may also be dead and reclaimed.
280 do
281 end
282
283 free (object: ANY) is
284 -- Free `object', by-passing garbage collection.
285 -- Erratic behavior will result if the object is still
286 -- referenced.
287 do
288 check
289 False
290 end
291 end
292
293 mem_free (addr: POINTER) is
294 -- Free memory of object at `addr'.
295 -- (Preferred interface is `free'.)
296 do
297 check
298 False
299 end
300 end
301
302 full_coalesce is
303 -- Coalesce the whole memory: merge adjacent free
304 -- blocks to reduce fragmentation. Useful, when
305 -- a lot of memory is allocated with garbage collector off.
306 do
307 check
308 False
309 end
310 end
311
312 collect is
313 -- Force a partial collection cycle if garbage
314 -- collection is enabled; do nothing otherwise.
315 do
316 check
317 False
318 end
319 end
320
321 full_collect is
322 -- Force a full collection cycle if garbage
323 -- collection is enabled; do nothing otherwise.
324 do
325 check
326 False
327 end
328 end
329
330 feature {NONE} -- Implementation
331
332 gc_monitoring (flag: BOOLEAN) is
333 -- Set up GC monitoring according to `flag'
334 do
335 check
336 False
337 end
338 end
339
340 find_referers (target: POINTER; esult: POINTER; result_size: INTEGER) is
341 do
342 check
343 False
344 end
345 end
346
347 indexing
348
349 library: "[
350 EiffelBase: Library of reusable components for Eiffel.
351 ]"
352
353 status: "[
354 --| Copyright (c) 1993-2006 University of Southern California and contributors.
355 For ISE customers the original versions are an ISE product
356 covered by the ISE Eiffel license and support agreements.
357 ]"
358
359 license: "[
360 EiffelBase may now be used by anyone as FREE SOFTWARE to
361 develop any product, public-domain or commercial, without
362 payment to ISE, under the terms of the ISE Free Eiffel Library
363 License (IFELL) at http://eiffel.com/products/base/license.html.
364 ]"
365
366 source: "[
367 Interactive Software Engineering Inc.
368 ISE Building
369 360 Storke Road, Goleta, CA 93117 USA
370 Telephone 805-685-1006, Fax 805-685-6869
371 Electronic mail <info@eiffel.com>
372 Customer support http://support.eiffel.com
373 ]"
374
375 info: "[
376 For latest info see award-winning pages: http://eiffel.com
377 ]"
378
379 end -- class MEMORY
380
381
382

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23