dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] [bugs #9086] Marshaled memory management differs from


From: Marcus Urban
Subject: [Pnet-developers] [bugs #9086] Marshaled memory management differs from .NET
User-agent: Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.4.21-144-athlon; X11; i686; en_US, en) (KHTML, like Gecko)

This mail is an automated notification from the bugs tracker
 of the project: DotGNU Portable.NET.




/**************************************************************************/
[bugs #9086] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9086>
Project: DotGNU Portable.NET
Submitted by: Marcus Urban
On: Tue 05/25/04 at 00:16

Category:  None
Severity:  5 - Average
Item Group:  None
Resolution:  None
Assigned to:  None
Status:  Open


Summary:  Marshaled memory management differs from .NET

Original Submission:  The memory management conventions used when marshaling 
parameters and return types in P/Invoke appear to differ from those described 
and implemented in .NET.

Specifically, when .NET marshals a class or string and passes to pass to 
unmanaged code, the runtime creates a temporary copy of the data and passes a 
pointer to the temporary data. Once the unmanaged method returns, the .NET 
runtime frees the temporary data. The Pnet runtime does not seem to free the 
temporary storage. The result is that a programming might find that his program 
works on Pnet but not Mono or .NET.

A similar situation occurs with return values, especially strings. When a 
P/Invoke method returns a string, .NET attempts to free the string.

(Yes, the conventions described here are sometimes inconvenient for interop. 
For example, if a C function returns a pointer to a static string buffer that 
should not be freed, the default marshaling for string is not acceptable, and 
the programmer must use IntPtr for the return type and marshal the data 
manually.)











For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=9086>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]