|
|
| version 1.2, 2003/07/24 11:31:20 | version 1.20, 2023/09/26 20:49:06 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b memory parser class. | Parser: @b memory parser class. |
| Copyright(c) 2001-2003 ArtLebedev Group(http://www.artlebedev.com) | Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) | Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> |
| */ | */ |
| static const char* IDENT_MATH_C="$Date$"; | |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_vmemory.h" | #include "pa_vmemory.h" |
| #include "pa_request.h" | #include "pa_request.h" |
| #include "pa_vmethod_frame.h" | |
| volatile const char * IDENT_MEMORY_C="$Id$" IDENT_PA_VMEMORY_H; | |
| class MMemory: public Methoded { | class MMemory: public Methoded { |
| public: | public: |
| Line 21 public: // Methoded | Line 22 public: // Methoded |
| // global variables | // global variables |
| DECLARE_CLASS_VAR(memory, 0 /*fictive*/, new MMemory); | DECLARE_CLASS_VAR(memory, new MMemory); |
| static void _compact(Request& r, MethodParams& params) { | static void _compact(Request& r, MethodParams&) { |
| r.wipe_unused_execution_stack(); | r.wipe_unused_execution_stack(); |
| #ifndef PA_DEBUG_DISABLE_GC | pa_gc_collect(true); |
| GC_gcollect(); | } |
| #endif | |
| static void _auto_compact(Request& r, MethodParams& params) { | |
| int divisor = params.as_int(0, "frequency must be int", r); | |
| if(divisor<0 || divisor>5) | |
| throw Exception(PARSER_RUNTIME, 0, "frequency '%d' is out of range 0..5", divisor); | |
| pa_gc_set_free_space_divisor(divisor); | |
| } | } |
| // constructor | // constructor |
| Line 35 static void _compact(Request& r, MethodP | Line 41 static void _compact(Request& r, MethodP |
| MMemory::MMemory(): Methoded("memory") { | MMemory::MMemory(): Methoded("memory") { |
| // ^compact[] | // ^compact[] |
| add_native_method("compact", Method::CT_STATIC, _compact, 0, 0); | add_native_method("compact", Method::CT_STATIC, _compact, 0, 0); |
| // ^auto-compact(N) | |
| add_native_method("auto-compact", Method::CT_STATIC, _auto_compact, 1, 1); | |
| } | } |