mirror of https://gitlab.com/basile.b/dexed.git
allow to minimize D GC heap immediatly
This commit is contained in:
parent
e9770a0be0
commit
3cbe5d2471
|
@ -18,11 +18,11 @@ export extern(C) void setRtOptions()
|
||||||
//config.gc = "precise";
|
//config.gc = "precise";
|
||||||
}
|
}
|
||||||
|
|
||||||
export extern(C) void minimizeGcHeap()
|
export extern(C) void minimizeGcHeap(bool now = false)
|
||||||
{
|
{
|
||||||
import core.memory : GC;
|
import core.memory : GC;
|
||||||
__gshared ubyte c;
|
__gshared ubyte c;
|
||||||
if (c++ > 31)
|
if (c++ > 31 || now)
|
||||||
{
|
{
|
||||||
GC.collect();
|
GC.collect();
|
||||||
GC.minimize();
|
GC.minimize();
|
||||||
|
|
|
@ -56,9 +56,9 @@ function d_rt_init(): integer; cdecl; external libdexedd_name;
|
||||||
function d_rt_term(): integer; cdecl; external libdexedd_name;
|
function d_rt_term(): integer; cdecl; external libdexedd_name;
|
||||||
// Used to release memroy allocated in external D functions that are called in a thread,
|
// Used to release memroy allocated in external D functions that are called in a thread,
|
||||||
// because managing the GC only works from the main thread.
|
// because managing the GC only works from the main thread.
|
||||||
// Memory is released every 32 calls.
|
// Memory is released every 32 calls unless `now` is true.
|
||||||
// This function must be called from the main thread.
|
// This function must be called from the main thread.
|
||||||
procedure minimizeGcHeap(); cdecl; external libdexedd_name;
|
procedure minimizeGcHeap(const now: boolean = false); cdecl; external libdexedd_name;
|
||||||
// noop
|
// noop
|
||||||
procedure setRtOptions(); cdecl; external libdexedd_name;
|
procedure setRtOptions(); cdecl; external libdexedd_name;
|
||||||
// Demangle a line possibly containing a D mangled name.
|
// Demangle a line possibly containing a D mangled name.
|
||||||
|
|
|
@ -1247,6 +1247,8 @@ begin
|
||||||
if fTempFileName.fileExists then
|
if fTempFileName.fileExists then
|
||||||
sysutils.DeleteFile(fTempFileName);
|
sysutils.DeleteFile(fTempFileName);
|
||||||
|
|
||||||
|
minimizeGcHeap(true);
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue