[Mono-bugs] [Bug 46378][Nor] Changed - Add MemoryStream that points to memory.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 15 Jul 2003 12:07:31 -0400 (EDT)
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 miguel@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=46378
--- shadow/46378 Tue Jul 15 11:18:15 2003
+++ shadow/46378.tmp.19642 Tue Jul 15 12:07:31 2003
@@ -1,14 +1,14 @@
Bug#: 46378
Product: Mono/Class Libraries
Version: unspecified
-OS:
+OS: unknown
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Normal
Component: CORLIB
AssignedTo: mono-bugs@ximian.com
ReportedBy: miguel@ximian.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -20,6 +20,55 @@
accessing data from an mmapped() region of memory (like the resource streams).
Maybe we already do something smart with the resources to avoid having to
manage it
Miguel.
+
+------- Additional Comments From miguel@ximian.com 2003-07-15 12:07 -------
+Ok, did some more research, I think Mono is on the right track in its
+infrastructure, but I wrote a sample program that shows that resources
+are loaded in its entirety in memory:
+
+using System;
+using System.Reflection;
+using System.IO;
+
+class D {
+ static void Main ()
+ {
+ Assembly a = System.Reflection.Assembly.GetCallingAssembly ();
+
+ Console.WriteLine ("Before, press [enter]");
+ Console.ReadLine ();
+
+ Stream s = a.GetManifestResourceStream (null, "hola");
+
+ Console.WriteLine ("Loaded, press [enter]");
+ Console.ReadLine ();
+ s.Position = 0;
+ s.ReadByte ();
+ s.Position = s.Length-1;
+ s.ReadByte ();
+ Console.WriteLine ("Done, press [enter]");
+ Console.ReadLine ();
+ }
+}
+
+Do this:
+
+dd if=/dev/zero of=hola bs=8192 count=1024
+mcs -resource:hola a.cs
+mono a.exe
+
+At bootstrap, Mono takes 3.6 megs of ram (RSS).
+
+You will see that by the time the message "Loaded" is shown, the RSS
+is up to 20 megabytes. Since the file is an 8 megabyte long file, I
+suspect that we have at this point two copies of the data in memory.
+
+The data gets eventually collected (the memory is never returned to
+the OS, as a collect wont reduce the RSS, but the memory is free: if
+you allocate 8 megs of data after the collect, the RSS will stay the
+same).
+
+