Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

implementing hard limit for GC heap #22180

Merged
merged 1 commit into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/ToolBox/SOS/Strike/sos.def
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ EXPORTS
dumpdelegate=DumpDelegate
DumpDomain
dumpdomain=DumpDomain
#ifdef TRACE_GC
DumpGCLog
dumpgclog=DumpGCLog
dlog=DumpGCLog
#endif
DumpGCData
dumpgcdata=DumpGCData
dgc=DumpGCData
Expand Down
19 changes: 11 additions & 8 deletions src/ToolBox/SOS/Strike/strike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9419,8 +9419,7 @@ DECLARE_API(DumpLog)
return Status;
}

#ifdef TRACE_GC

#ifndef FEATURE_PAL
DECLARE_API (DumpGCLog)
{
INIT_API_NODAC();
Expand All @@ -9433,6 +9432,10 @@ DECLARE_API (DumpGCLog)
}

const char* fileName = "GCLog.txt";
int iLogSize = 1024*1024;
BYTE* bGCLog = NULL;
int iRealLogSize = iLogSize - 1;
DWORD dwWritten = 0;

while (isspace (*args))
args ++;
Expand Down Expand Up @@ -9477,8 +9480,7 @@ DECLARE_API (DumpGCLog)
goto exit;
}

int iLogSize = 1024*1024;
BYTE* bGCLog = new NOTHROW BYTE[iLogSize];
bGCLog = new NOTHROW BYTE[iLogSize];
if (bGCLog == NULL)
{
ReportOOM();
Expand All @@ -9491,7 +9493,6 @@ DECLARE_API (DumpGCLog)
ExtOut("failed to read memory from %08x\n", dwAddr);
}

int iRealLogSize = iLogSize - 1;
while (iRealLogSize >= 0)
{
if (bGCLog[iRealLogSize] != '*')
Expand All @@ -9502,13 +9503,17 @@ DECLARE_API (DumpGCLog)
iRealLogSize--;
}

DWORD dwWritten = 0;
WriteFile (hGCLog, bGCLog, iRealLogSize + 1, &dwWritten, NULL);

Status = S_OK;

exit:

if (bGCLog != NULL)
{
delete [] bGCLog;
}

if (hGCLog != INVALID_HANDLE_VALUE)
{
CloseHandle (hGCLog);
Expand All @@ -9523,9 +9528,7 @@ DECLARE_API (DumpGCLog)

return Status;
}
#endif //TRACE_GC

#ifndef FEATURE_PAL
DECLARE_API (DumpGCConfigLog)
{
INIT_API();
Expand Down
6 changes: 5 additions & 1 deletion src/gc/env/gcenv.os.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,14 @@ class GCToOSInterface
// Get the physical memory that this process can use.
// Return:
// non zero if it has succeeded, 0 if it has failed
// *is_restricted is set to true if asked and running in restricted.
// Remarks:
// If a process runs with a restricted memory limit, it returns the limit. If there's no limit
// specified, it returns amount of actual physical memory.
static uint64_t GetPhysicalMemoryLimit();
//
// PERF TODO: Requires more work to not treat the restricted case to be special.
// To be removed before 3.0 ships.
static uint64_t GetPhysicalMemoryLimit(bool* is_restricted=NULL);

// Get memory status
// Parameters:
Expand Down
Loading