Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / September 2003

Tip: Looking for answers? Try searching our database.

HELP! Unmanaged memory management from within managed code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arthur Mnev - 20 Sep 2003 04:17 GMT
When kernel/crtdll/msvcrt memory allocations are p/invoked from
managed (C#) code; where exactly is that memory allocated? Does
"static" memory allocation made by C++/C runtime library functions
will cause memory fragmentation within CLR's heap (and thereby
possibly reduce GC's efficiency).

- Arthur
Nick Wienholt - 20 Sep 2003 08:17 GMT
> When kernel/crtdll/msvcrt memory allocations are p/invoked from
> managed (C#) code; where exactly is that memory allocated?

On the heap that these functions normally use when called from unmanaged
code.  Each of these functions will have its own heap, and not interfere
with the managed heap.

It is actually faster to use an unmanaged heap and copy memory back and
forth between the unmanaged and managed heap in interop scenarios, as simply
pinning the managed heap hurts allocation and collection performance.  The
speed improvement isn't important for most scenarios, but if heavy interop
is being used, unmanaged heaps can actually lead to noticeable performance
gains.

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org

> When kernel/crtdll/msvcrt memory allocations are p/invoked from
> managed (C#) code; where exactly is that memory allocated? Does
[quoted text clipped - 3 lines]
>
> - Arthur
Arthur Mnev - 24 Sep 2003 04:56 GMT
Thanks for the reply, this is exactly what i was looking for. Running
a few tests will post results soon.

> > When kernel/crtdll/msvcrt memory allocations are p/invoked from
> > managed (C#) code; where exactly is that memory allocated?
[quoted text clipped - 22 lines]
> >
> > - Arthur

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.