使用垃圾回收替代内存回收api

This commit is contained in:
阿甘 2024-06-18 23:08:53 +08:00
parent 662a00aed3
commit da52c467cc

View File

@ -20,11 +20,9 @@ plus={cls="plus";left=0;top=0;right=1400;bottom=36;bgcolor=16777215;border={left
//整理内存
import process;
import raw;
EmptyWorkingSet := ::Psapi.api("EmptyWorkingSet","bool(pointer hanld)")
mainForm.release = function(){
var hanld = process.OpenProcess(0x1f0fff,false,process.getId())
EmptyWorkingSet(hanld)
raw.closehandle(hanld)
collectgarbage("collect");
collectgarbage("collect");
}
var frmChild = mainForm.loadForm("\dlg\searchForm.aardio");
@ -64,7 +62,6 @@ showUnmodifyStyle();
//menu-新建
g_teMenus.newFile = function(ctrl){
return function(){
mainForm.release();
var curRow = mainForm.g_flexcell.ActiveCell().Row;
var curCol = mainForm.g_flexcell.ActiveCell().Col;
mainForm.g_flexcell.FrozenRows = 0;
@ -74,6 +71,7 @@ g_teMenus.newFile = function(ctrl){
mainForm.g_flexcell.clear();
teUtils.initFlexCellShow(mainForm.g_flexcell);
showUnmodifyStyle();
mainForm.release();
}
}
@ -307,15 +305,13 @@ mainForm.popmenuLeft.add('向上插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
mainForm.release();
} )
mainForm.popmenuLeft.add('向下插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow + 1, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
mainForm.release();
} )
//右侧弹出菜单
mainForm.popmenuRight = win.ui.popmenu(mainForm);
@ -323,15 +319,13 @@ mainForm.popmenuRight.add('向左插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
mainForm.release();
} )
mainForm.popmenuRight.add('向右插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol+1, 1, mainForm.g_flexcell.colCount);
curSelection.release();
collectgarbage("collect");
collectgarbage("collect");
mainForm.release();
} )