|
|
| version 1.16, 2020/12/15 00:26:11 | version 1.22, 2026/04/25 13:38:46 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b memory parser class. | Parser: @b memory parser class. |
| Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) | Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> |
| */ | */ |
| #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; | volatile const char * IDENT_MEMORY_C="$Id$" IDENT_PA_VMEMORY_H; |
| Line 25 DECLARE_CLASS_VAR(memory, new MMemory); | Line 26 DECLARE_CLASS_VAR(memory, new MMemory); |
| static void _compact(Request& r, MethodParams&) { | 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_enable(); | |
| GC_gcollect(); | static void _auto_compact(Request& r, MethodParams& params) { |
| GC_disable(); | int divisor = params.as_int(0, "frequency must be int", r); |
| } | if(divisor<0 || divisor>5) |
| #endif | throw Exception(PARSER_RUNTIME, 0, "frequency '%d' is out of range 0..5", divisor); |
| pa_gc_set_free_space_divisor(divisor); | |
| } | } |
| // constructor | // constructor |
| Line 39 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); | |
| } | } |