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: Thong Nguyen
Subject: [Pnet-developers] [bugs #9086] Marshaled memory management differs from .NET
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2; .NET CLR 1.1.4322)

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

/**************************************************************************/
[bugs #9086] Latest Modifications:

Changes by: 
                Thong Nguyen <address@hidden>
'Date: 
                Sat 06/19/2004 at 05:11 (NZ)

------------------ Additional Follow-up Comments ----------------------------
Well strings returned from unmanaged code will be automatically freed now.

Not sure about the other stuff yet...






/**************************************************************************/
[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/2004 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.)

Follow-up Comments
------------------


-------------------------------------------------------
Date: Sat 06/19/2004 at 05:11       By: tum
Well strings returned from unmanaged code will be automatically freed now.

Not sure about the other stuff yet...












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]