Revert "Added method ReleaseManagedCommandLine to release memory"
authorBrian Sullivan <briansul@microsoft.com>
Fri, 26 Apr 2019 21:07:29 +0000 (14:07 -0700)
committerBrian Sullivan <briansul@microsoft.com>
Fri, 26 Apr 2019 21:07:29 +0000 (14:07 -0700)
This reverts commit dotnet/coreclr@1f2435763926f6068fc88a36a2b8dc49c263f271.

Commit migrated from https://github.com/dotnet/coreclr/commit/78bfc4fbd634f34870e4c11f280c36b7ed696c9f

src/coreclr/src/vm/ceeload.cpp
src/coreclr/src/vm/ceeload.h
src/coreclr/src/vm/corhost.cpp

index ab5d6e8..66b8d53 100644 (file)
@@ -11700,7 +11700,7 @@ void SaveManagedCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv)
     CONTRACTL_END;
 
     // Get the command line.
-    LPCWSTR osCommandLine = GetCommandLineW();
+    LPCWSTR osCommandLine  = GetCommandLineW();
 
 #ifndef FEATURE_PAL
     // On Windows, osCommandLine contains the executable and all arguments.
@@ -11737,17 +11737,6 @@ void SaveManagedCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv)
 #endif 
 }
 
-// Release any memory that we allocated for the managed command line
-void ReleaseManagedCommandLine()
-{
-    LIMITED_METHOD_CONTRACT;
-
-#ifdef FEATURE_PAL
-    delete[] s_pCommandLine; 
-    s_pCommandLine = NULL;
-#endif
-}
-
 static void ProfileDataAllocateScenarioInfo(ProfileEmitter * pEmitter, LPCSTR scopeName, GUID* pMvid)
 {
     CONTRACTL
index adfefcc..407d969 100644 (file)
@@ -3423,7 +3423,5 @@ struct VASigCookieEx : public VASigCookie
 LPCWSTR GetManagedCommandLine();
 // Save the command line for the current process.
 void SaveManagedCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv);
-// Release any memory that we allocated for the managed command line
-void ReleaseManagedCommandLine();
 
 #endif // !CEELOAD_H_
index c588e31..6487c52 100644 (file)
@@ -469,11 +469,6 @@ HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId,
 
         GCPROTECT_END();
 
-        // When running under FEATURE_PAL, the SetCommandLineArgs call above will
-        // call SaveManagedCommandLine which will allocate memory using new WCHAR[]
-        // We can release this memory now.
-        //
-        ReleaseManagedCommandLine();
     }
 
     UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;