File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1089,7 +1089,8 @@ private:
10891089 auto time = profileStats.totalCollectionTime - mProfileStats.totalCollectionTime;
10901090 if (dbgfh)
10911091 dbglog(" GC: " ~ to! string (count) ~ " collections took " ~ to! string (time.total! " msecs" ) ~ " ms, " ~
1092- " now at " ~ to! string (stats.usedSize >> 20 ) ~ " MB" );
1092+ " now using " ~ to! string (stats.usedSize >> 20 ) ~ " MB, " ~
1093+ to! string (stats.freeSize >> 20 ) ~ " MB free" );
10931094
10941095 mProfileStats = profileStats;
10951096 }
Original file line number Diff line number Diff line change @@ -93,6 +93,26 @@ private void dbglog(string s)
9393 }
9494 writeToBuildOutputPane(cast (string )(strtm[0 .. len] ~ firstLine(s) ~ " \n " ), false );
9595}
96+
97+ void checkGCStats ()
98+ {
99+ import core.memory ;
100+ static GC .ProfileStats mProfileStats;
101+ auto profileStats = GC .profileStats();
102+ if (profileStats.numCollections == mProfileStats.numCollections)
103+ return ;
104+
105+ auto stats = GC .stats();
106+
107+ auto count = profileStats.numCollections - mProfileStats.numCollections;
108+ auto time = profileStats.totalCollectionTime - mProfileStats.totalCollectionTime;
109+ dbglog(" GC: " ~ to! string (count) ~ " collections took " ~ to! string (time.total! " msecs" ) ~ " ms, " ~
110+ " now using " ~ to! string (stats.usedSize >> 20 ) ~ " MB, " ~
111+ to! string (stats.freeSize >> 20 ) ~ " MB free" );
112+
113+ mProfileStats = profileStats;
114+ }
115+
96116}
97117
98118// /////////////////////////////////////////////////////////////////////
@@ -1122,6 +1142,8 @@ class VDServerClient
11221142 }
11231143 ))
11241144 {
1145+ version (DebugCmd) if (dbglog_enabled)
1146+ checkGCStats();
11251147 }
11261148 }
11271149 catch (Throwable e)
You can’t perform that action at this time.
0 commit comments