[Mono-bugs] [Bug 36502][Min] New - Strings returned from P/Invoke methods are not freed

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 9 Jan 2003 04:11:06 -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 mathpup@mylinuxisp.com.


--- shadow/36502	Thu Jan  9 04:11:06 2003
+++ shadow/36502.tmp.11486	Thu Jan  9 04:11:06 2003
@@ -0,0 +1,29 @@
+Bug#: 36502
+Product: Mono/Runtime
+Version: unspecified
+OS Details: SuSE Linux 8.0
+Status: NEW   
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Strings returned from P/Invoke methods are not freed
+Description of Problem:   
+When P/Invoke method, such as    
+static extern string myFunction();   
+is called, the runtime converts the char* actually returned by the method   
+into System.String. However, according to Dietmar, the Mono runtime never   
+frees the char* string. I understand that under .NET, the runtime assumes  
+that the memory was allocated using CoTaskMemAlloc() and it attempts to 
+free the memory.