[Mono-bugs] [Bug 52524][Nor] Changed - gc.log littered everywhere

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 12 Feb 2004 09:31:49 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by liyul@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=52524

--- shadow/52524	2004-02-12 08:20:39.000000000 -0500
+++ shadow/52524.tmp.2550	2004-02-12 09:31:49.000000000 -0500
@@ -21,6 +21,63 @@
 policy or directory Read/Write rights assignment.
 
 ------- Additional Comments From vargaz@freemail.hu  2004-02-12 08:20 -------
 Do you still see this problem with 0.30 ? If yes, which programs 
 produce a gc.log file ? Is it all programs, or just programs which
 crashed etc ?
+
+------- Additional Comments From liyul@hotmail.com  2004-02-12 09:31 -------
+It happens with almost every program run with mono, from simple
+console program to xsp. And it happens with mono-0.30 under windows.
+
+I wouldn't mind that much if it were put under %tmp%, --now it is
+created always in the "current work directory" or aspnet root
+directory. I'm not sure whether it will adversely affect the programs
+when the current work directory could be readonly.
+
+Search found "gc.log" in mono\libgc\misc.c, maybe it's there.
+
+#if defined(MSWIN32) || defined(MSWINCE)
+# define LOG_FILE _T("gc.log")
+
+  HANDLE GC_stdout = 0;
+
+  void GC_deinit()
+  {
+      if (GC_is_initialized) {
+  	DeleteCriticalSection(&GC_write_cs);
+      }
+  }
+
+  int GC_write(buf, len)
+  GC_CONST char * buf;
+  size_t len;
+  {
+      BOOL tmp;
+      DWORD written;
+      if (len == 0)
+	  return 0;
+      EnterCriticalSection(&GC_write_cs);
+      if (GC_stdout == INVALID_HANDLE_VALUE) {
+	  return -1;
+      } else if (GC_stdout == 0) {
+	  GC_stdout = CreateFile(LOG_FILE, GENERIC_WRITE,
+        			 FILE_SHARE_READ | FILE_SHARE_WRITE,
+        			 NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH,
+        			 NULL); 
+    	  if (GC_stdout == INVALID_HANDLE_VALUE) ABORT("Open of log file
+failed");
+      }
+      tmp = WriteFile(GC_stdout, buf, len, &written, NULL);
+      if (!tmp)
+	  DebugBreak();
+      LeaveCriticalSection(&GC_write_cs);
+      return tmp ? (int)written : -1;
+  }
+
+#endif
+
+
+Typical contents of the file is a few lines of
+
+Needed to allocate blacklisted block at 0x2742000
+...