unmanaged resource

G

George2

Hello everyone,


I think unmanaged resource means the resources (e.g. memory and file
handler) which is used directly (new, FILE*) other than using a
wrapper class (Resource Acquisition Is Initialization) or auto_ptr to
wrap it. Is my understanding correct?

Here is a sample about what is unmanaged resource.

--------------------
http://www.gotw.ca/gotw/066.htm

Moral #3: Always perform unmanaged resource acquisition in the
constructor body, never in initializer lists. In other words, either
use "resource acquisition is initialization" (thereby avoiding
unmanaged resources entirely) or else perform the resource acquisition
in the constructor body.
 
E

Erik Wikström

Hello everyone,


I think unmanaged resource means the resources (e.g. memory and file
handler) which is used directly (new, FILE*) other than using a
wrapper class (Resource Acquisition Is Initialization) or auto_ptr to
wrap it. Is my understanding correct?

Here is a sample about what is unmanaged resource.

--------------------
http://www.gotw.ca/gotw/066.htm

Moral #3: Always perform unmanaged resource acquisition in the
constructor body, never in initializer lists. In other words, either
use "resource acquisition is initialization" (thereby avoiding
unmanaged resources entirely) or else perform the resource acquisition
in the constructor body.
--------------------

You are kind of correct, an unmanaged resource is a resource which you
explicitly have to free when you are done using it. If you do not free
it and you no longer have a handle to it you have a resource-leak. It is
important to notice that not all wrapper necessarily free resources.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top