[Mono-bugs] [Bug 75784][Wis] New - Calling
ParameterInfo.GetCustomAttributes can cause an unmanaged memory leak
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Aug 11 11:13:17 EDT 2005
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 will at cambia.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75784
--- shadow/75784 2005-08-11 11:13:17.000000000 -0400
+++ shadow/75784.tmp.25743 2005-08-11 11:13:17.000000000 -0400
@@ -0,0 +1,76 @@
+Bug#: 75784
+Product: Mono: Runtime
+Version: 1.1
+OS: other
+OS Details: Fedora Core release 2 (Tettnang)
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: will at cambia.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Calling ParameterInfo.GetCustomAttributes can cause an unmanaged memory leak
+
+Description of Problem:
+
+Compile and run the following program in Mono 1.1.8:
+
+using System;
+using System.Reflection;
+
+namespace LeakMaker {
+ enum ValueEnum {
+ False,
+ True
+ }
+
+ [AttributeUsage(AttributeTargets.Parameter)]
+ class TestAttribute : Attribute {
+ public TestAttribute() {
+ _val = ValueEnum.False;
+ }
+
+ private ValueEnum _val;
+
+ public ValueEnum Value {
+ get { return _val; }
+ set { _val = value; }
+ }
+ }
+ interface IMyInterface {
+ int MyMethod(
+ [Test(Value=ValueEnum.True)] int myparam
+ );
+ }
+ class MainClass {
+ static void Main(string[] args) {
+ MethodInfo mi = typeof(IMyInterface).GetMethod("MyMethod");
+ ParameterInfo pi = mi.GetParameters()[0];
+ while (true) {
+ pi.GetCustomAttributes(typeof(TestAttribute), true);
+ }
+ }
+ }
+}
+
+Actual Results:
+
+All available memory on the system is used up very quickly.
+
+Expected Results:
+
+The program would run indefinitely.
+
+How often does this happen?
+
+Every time.
+
+Additional Information:
+
+Inserting a call to GC.GetTotalMemory shows the managed heap size remains
+constant.
More information about the mono-bugs
mailing list