使用垃圾回收替代内存回收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 process;
import raw; import raw;
EmptyWorkingSet := ::Psapi.api("EmptyWorkingSet","bool(pointer hanld)")
mainForm.release = function(){ mainForm.release = function(){
var hanld = process.OpenProcess(0x1f0fff,false,process.getId()) collectgarbage("collect");
EmptyWorkingSet(hanld) collectgarbage("collect");
raw.closehandle(hanld)
} }
var frmChild = mainForm.loadForm("\dlg\searchForm.aardio"); var frmChild = mainForm.loadForm("\dlg\searchForm.aardio");
@ -64,7 +62,6 @@ showUnmodifyStyle();
//menu-新建 //menu-新建
g_teMenus.newFile = function(ctrl){ g_teMenus.newFile = function(ctrl){
return function(){ return function(){
mainForm.release();
var curRow = mainForm.g_flexcell.ActiveCell().Row; var curRow = mainForm.g_flexcell.ActiveCell().Row;
var curCol = mainForm.g_flexcell.ActiveCell().Col; var curCol = mainForm.g_flexcell.ActiveCell().Col;
mainForm.g_flexcell.FrozenRows = 0; mainForm.g_flexcell.FrozenRows = 0;
@ -74,6 +71,7 @@ g_teMenus.newFile = function(ctrl){
mainForm.g_flexcell.clear(); mainForm.g_flexcell.clear();
teUtils.initFlexCellShow(mainForm.g_flexcell); teUtils.initFlexCellShow(mainForm.g_flexcell);
showUnmodifyStyle(); showUnmodifyStyle();
mainForm.release();
} }
} }
@ -307,15 +305,13 @@ mainForm.popmenuLeft.add('向上插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection(); var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow, 1, mainForm.g_flexcell.colCount); teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow, 1, mainForm.g_flexcell.colCount);
curSelection.release(); curSelection.release();
collectgarbage("collect"); mainForm.release();
collectgarbage("collect");
} ) } )
mainForm.popmenuLeft.add('向下插入一行',function(id){ mainForm.popmenuLeft.add('向下插入一行',function(id){
var curSelection = mainForm.g_flexcell.selection(); var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow + 1, 1, mainForm.g_flexcell.colCount); teUtils.insertFlexCellNewRow(mainForm.g_flexcell, curSelection.FirstRow + 1, 1, mainForm.g_flexcell.colCount);
curSelection.release(); curSelection.release();
collectgarbage("collect"); mainForm.release();
collectgarbage("collect");
} ) } )
//右侧弹出菜单 //右侧弹出菜单
mainForm.popmenuRight = win.ui.popmenu(mainForm); mainForm.popmenuRight = win.ui.popmenu(mainForm);
@ -323,15 +319,13 @@ mainForm.popmenuRight.add('向左插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection(); var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol, 1, mainForm.g_flexcell.colCount); teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol, 1, mainForm.g_flexcell.colCount);
curSelection.release(); curSelection.release();
collectgarbage("collect"); mainForm.release();
collectgarbage("collect");
} ) } )
mainForm.popmenuRight.add('向右插入一列',function(id){ mainForm.popmenuRight.add('向右插入一列',function(id){
var curSelection = mainForm.g_flexcell.selection(); var curSelection = mainForm.g_flexcell.selection();
teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol+1, 1, mainForm.g_flexcell.colCount); teUtils.insertFlexCellNewCol(mainForm.g_flexcell, curSelection.FirstCol+1, 1, mainForm.g_flexcell.colCount);
curSelection.release(); curSelection.release();
collectgarbage("collect"); mainForm.release();
collectgarbage("collect");
} ) } )