473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Memory consumption when using COM interop?

I'm using a COM DLL in my C# application (a single process).
This COM DLL generates a data array, and by using the interop DLL (generated
by VS/TlbImp.exe), I'm getting this array to a safe Array into my C# code
(using the marshaling and all that...).

My Question is:
Does a multiple data arrays is allocated when marshaling the data from the
COM component to my C# component. I mean; Does an array is allocated in the
COM side and another array in the C# side and the content is copied among
this two arrays?
Or the C# side uses the allocated array directly at the COM side?
--
Thanks
Sharon
Mar 20 '07 #1
2 1741
It depends on what type of data will be passed.
Check if this can clarify:
http://www.samspublishing.com/articl...&seqNum=7&rl=1

"Sharon" <Sh*****@newsgroups.nospamha scritto nel messaggio
news:F5**********************************@microsof t.com...
I'm using a COM DLL in my C# application (a single process).
This COM DLL generates a data array, and by using the interop DLL
(generated
by VS/TlbImp.exe), I'm getting this array to a safe Array into my C# code
(using the marshaling and all that...).

My Question is:
Does a multiple data arrays is allocated when marshaling the data from the
COM component to my C# component. I mean; Does an array is allocated in
the
COM side and another array in the C# side and the content is copied among
this two arrays?
Or the C# side uses the allocated array directly at the COM side?
--
Thanks
Sharon

Mar 20 '07 #2
"Sharon" <Sh*****@newsgroups.nospamwrote in message
news:F5**********************************@microsof t.com...
I'm using a COM DLL in my C# application (a single process).
This COM DLL generates a data array, and by using the interop DLL (generated
by VS/TlbImp.exe), I'm getting this array to a safe Array into my C# code
(using the marshaling and all that...).

My Question is:
Does a multiple data arrays is allocated when marshaling the data from the
COM component to my C# component. I mean; Does an array is allocated in the
COM side and another array in the C# side and the content is copied among
this two arrays?
Or the C# side uses the allocated array directly at the COM side?
--
Thanks
Sharon

The SafeArray in 'COM land' is copied to a managed array in 'managed land'. Managed code
doesn't know anything about "SafeArrays" and COM doesn't know about "CLR arrays", so, one
needs to marshal the array from one representation to another, the COM (and the PInvoke)
interop marshaler knows exactly how to deal with this, as both array types carry the
necessary type information.

Willy.

Mar 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Geoff Pennington | last post by:
The memory consumed by aspnet_wp.exe just keeps going up (as tracked in Task Manager) until I restart it, so I must have a memory leak. If it makes a difference, my app makes considerable use of...
16
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid,...
9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
16
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. ...
10
by: Marty | last post by:
Hi, Does anybody is experiencing a lot of RAM consumption when using many threads ? If yes, how can we reduce that level of used memory? Thanks tou! Marty
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
9
by: Adam Right | last post by:
Hi, Anyone suffers from the high memory usage of C# in windows applications? Is there a solution for that problem? Thanks...
12
by: Tony | last post by:
Hi expert, I installed DB2 v8.2 server on Solaris 9 box. When I connect to DB2 using control centre or other applications(except command line), around 12 db2sysc processes pop up and each one...
17
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.