mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Collect garbage after every call
This commit is contained in:
parent
56c522274c
commit
49bc9f0326
@ -301,7 +301,7 @@ namespace scripting::lua
|
||||
|
||||
context::~context()
|
||||
{
|
||||
this->state_.collect_garbage();
|
||||
this->collect_garbage();
|
||||
this->scheduler_.clear();
|
||||
this->event_handler_.clear();
|
||||
this->state_ = {};
|
||||
@ -310,12 +310,18 @@ namespace scripting::lua
|
||||
void context::run_frame()
|
||||
{
|
||||
this->scheduler_.run_frame();
|
||||
this->state_.collect_garbage();
|
||||
this->collect_garbage();
|
||||
}
|
||||
|
||||
void context::notify(const event& e)
|
||||
{
|
||||
this->event_handler_.dispatch(e);
|
||||
this->collect_garbage();
|
||||
}
|
||||
|
||||
void context::collect_garbage()
|
||||
{
|
||||
this->state_.collect_garbage();
|
||||
}
|
||||
|
||||
void context::load_script(const std::string& script)
|
||||
|
@ -30,6 +30,7 @@ namespace scripting::lua
|
||||
|
||||
void run_frame();
|
||||
void notify(const event& e);
|
||||
void collect_garbage();
|
||||
|
||||
private:
|
||||
sol::state state_{};
|
||||
|
Loading…
Reference in New Issue
Block a user