473,396 Members | 2,013 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,396 software developers and data experts.

UnManaged object clearance without dispose or finalizer

Dear All,

Please help me to sort one of my doubts regarding Release of Un-Managed Objects. If we are not explicitly calling dispose/close method for un-managed objects neither we are implementing finalizer for this unmanaged objects then what will happened for this unmanaged objects. Whether Operating system will take care after some time to release it or it will stay there till Operating system shouldn't get restarted. Please share your views regarding it.
Sep 17 '11 #1
1 1641
Frinavale
9,735 Expert Mod 8TB
Check out this MSDN article about the IDisposable interface. It gives you a good idea of why you should implement this interface whenever your code uses unmanaged code.

The article states:

The garbage collector automatically releases the memory allocated to a managed object when that object is no longer used. However, it is not possible to predict when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as window handles, or open files and streams.

Use the Dispose method of this interface to explicitly release unmanaged resources in conjunction with the garbage collector. The consumer of an object can call this method when the object is no longer needed.
Sep 17 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Timo | last post by:
I'm trying to make a thread safe object cache without locking. The objects are cached by the id of the data dict given in __new__. Objects are removed from the cache as soon as they are no longer...
1
by: Damon Allison | last post by:
Hello, My program is being sent a large XML file, anywhere between 500k - 1MB. Of the entire file, I need to allow a user to view/edit approximately 5% of it. To make matters a bit more...
3
by: Daniel K. | last post by:
I have a form derived mdi child with a private field that holds the instance of a business class. As i noticed, this business object stays until the program (which in fact is the parent form)...
2
by: wbekker | last post by:
Hi, We have a system with quite a lot references between objects. One of the objects does not dispose, but i am not able to find out why. Probably this is because of a live reference to the...
6
by: Raghu | last post by:
In C#, the typeof keyword can be used to get a type of the class. This does not require object to be created first. However O am not sure how do the same thing in vb. I don't want to create the...
6
by: shu | last post by:
Is it legal to declare a static instance of an object compiled in a "No CLR support" .obj? I have the next .cpp, in which I mix definition of CTest and declarion of the static var in the same...
2
by: nij | last post by:
Hi, I am developing a C# control for my own use that will be used lots of times on a form. It's inherited direct from Control, so I am doing all the drawing myself... and as there are lots of...
1
by: Joneleth | last post by:
Hi I know how to call external c functions in c# through DllImport. Now, i'm trying to call a c++ (unmanaged) class method, defined in an external .dll as static int myClass::myMethod, and i...
1
by: DaTurk | last post by:
Hi, I'm trying to have a unmanaged object contatined in a a managed class. THis is no problem, but I need access to this object in other managed classes. I'm not sure how to do this. I mean,...
3
by: Reckoner | last post by:
would it be possible to use one of an object's methods without initializing the object? In other words, if I have: class Test: def __init__(self): print 'init' def foo(self): print 'foo'
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: 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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.