mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 02:37:48 +01:00
configurable gc threshold
This commit is contained in:
@@ -40,6 +40,7 @@ private:
|
||||
const static inline std::unordered_map<std::string, std::variant<size_t, bool>> _defaults{{"cell_limit", 50000U},
|
||||
{"command_strs", false},
|
||||
{"default_log_level", 1U},
|
||||
{"gc_threshold", 50U},
|
||||
{"repl", true}};
|
||||
|
||||
std::unordered_map<std::string, std::variant<size_t, bool>> _current = _defaults;
|
||||
|
||||
@@ -95,7 +95,8 @@ private:
|
||||
std::lock_guard tmplg(_new_roots_lock);
|
||||
Handle ret(cell);
|
||||
_temp_cells.emplace_back(cell);
|
||||
if ((_cells_num + _temp_cells.size() + 1) >= (size_t) (Options::get<size_t>("cell_limit") / 2)) {
|
||||
if ((_cells_num + _temp_cells.size()) >=
|
||||
((Options::get<size_t>("cell_limit") * Options::get<size_t>("gc_threshold")) / 100ULL)) {
|
||||
request_gc();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -35,7 +35,7 @@ void VM::step() {
|
||||
if (!_d.null()) out << "d:" << _d << "\n";
|
||||
},
|
||||
Logger::TRACE);
|
||||
|
||||
|
||||
switch (poppedCmd) {
|
||||
case NIL: {
|
||||
_s.push(nullptr);
|
||||
@@ -300,6 +300,7 @@ void VM::step() {
|
||||
std::string read;
|
||||
std::getline(_instream, read);
|
||||
_s.push(Parser::parse_str(read));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw std::invalid_argument("Unknown command: " + std::to_string(poppedCmd));
|
||||
|
||||
Reference in New Issue
Block a user