Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

C# Question


JeffSventora
 Share

Recommended Posts

I know that C# has it's own garbage collector, but I need to use my own for technical reasons. In C++ my code looks like this:

```
void Release(void)
{
--m_uiRefCount;

if(m_uiRefCount == 0)
delete this;
}
```
As you can see, if the Reference Count equals zero, it deletes itself. How could I achieve the same functionality in C#? I've been looking all over the place…
Link to comment
Share on other sites

If you are seriously asking this question, then you don't seem to comprehend the difference between heap allocation and heap allocation backed up by a garbage collecting virtual machine. With the latter you'll never have to release any memory yourself (the only thing you could be able to do is hint the garbage collector to free it already, but most garbage collectors don't support that functionality because of sanity reasons).

Yours faithfully,
  Stephan.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...