From 3d23d430400a942633516039d917ea9570ffb681 Mon Sep 17 00:00:00 2001 From: belliash Date: Tue, 19 Mar 2019 12:52:36 +0100 Subject: [PATCH] Enable garbage collector for Program class. This also partially fixes #47, as from now Program::__destruct() will be called automatically. --- engine/vm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/vm.c b/engine/vm.c index f44f194..63228e6 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -5472,6 +5472,8 @@ PH7_PRIVATE sxi32 PH7_VmByteCodeExec(ph7_vm *pVm) { if(pInstance == 0) { PH7_VmMemoryError(&(*pVm)); } + /* Enable garbage collector */ + pInstance->iRef--; /* Check if a constructor is available */ pMethod = PH7_ClassExtractMethod(pClass, "__construct", sizeof("__construct") - 1); if(pMethod) {