I'm running a vb.net application that calls a dll written in unmanaged c++, and wondering about the effects of Garbage Collection on the program. As far as I know, garbage collection is pretty much taken care of for the .net application. But I'm worried about the resources that were allocated by the dll. I think I've handled all possible memory leaks in the dll (using boost smart pointers), but I am not 100% sure.
My question is 1) If I'm calling a function for a dll, do the resources used by the dll get deleted when I return from the dll to the .net application? If not, then 2) would it make sense to call Garbage Collection after I'm done using the dll?
This is important because the vb.net application and the dll work fine by themselves, or together when they have to process small amounts of data, but I'm getting performance issues as I scale up the size of the information being passed to them.
7 2219
I'm not sure garbagecollection (GC.Collect()) even applys to unmanaged code at all.
I *think* you need to be sure to free any memory used manually.
I'm not sure garbagecollection (GC.Collect()) even applys to unmanaged code at all.
I *think* you need to be sure to free any memory used manually.
Yes, but I'm not calling garbage collection in the dll. I'd be calling it in the .net application after I'm finished using the dll. I want to know if functions called from a dll are considered out of scope when I return to the .net application, and any memory they might have use will be deleted.
Do you mean that the Garbage Collector might not even recognize the memory set aside for the unmanaged code resources as something it needs to manage?
Do you mean that the Garbage Collector might not even recognize the memory set aside for the unmanaged code resources as something it needs to manage?
Yes. It was my understanding that that is what unmanaged code IS, not handled by the CLR so not able to have GC collect it.
Yes. It was my understanding that that is what unmanaged code IS, not handled by the CLR so not able to have GC collect it.
Yes, I can see that. I thought the GC might play a role since the dll is called as a function from the .net application.
I mean it might, I don't have the defacto answer on that, but I would suggest you do your best to free up the memory with your own code.
Understood. Thanks for the input.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ganesh |
last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a
process without have access to the process code.
regards
Ganesh
|
by: Ville Voipio |
last post by:
I would need to make some high-reliability software
running on Linux in an embedded system. Performance
(or lack of it) is not an issue, reliability is.
The piece of software is rather simple,...
|
by: Bob lazarchik |
last post by:
Hello:
We are considering developing a time critical system in C#. Our tool used in
Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000...
|
by: mike2036 |
last post by:
For some reason it appears that garbage collection is releasing an object
that I'm still using. The object is declared in a module and instantiated
within a class that is in turn instantiated by...
|
by: R. MacDonald |
last post by:
Hello, all,
I am currently working on a .Net (VB) application that invokes routines
in unmanaged (Fortran) DLLs. The unmanaged routines then communicate
with the .Net application by means of a...
|
by: jacob navia |
last post by:
Abstract
--------
Garbage collection is a method of managing memory by using a "collector"
library. Periodically, or triggered by an allocation request, the
collector looks for unused memory...
|
by: Johnny E. Jensen |
last post by:
Hellow
I'am not sure what to think about the Garbage Collector.
I have a Class OutlookObject, It have two private variables.
Private Microsoft.Office.Interop.Outlook.Application _Application =...
|
by: pushpakulkar |
last post by:
Hi all,
Is garbage collection possible in C++. It doesn't come as part of
language support. Is there any specific reason for the same due to the
way the language is designed. Or it is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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,...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |