I’m dealing with pointer in C# using fixed{} phrases.
I placed my code inside the brackets of the fixed statement and want to know if the Garbage collection will handle the pointer freeing after the fixed statement
fixed{int * p=&x}
{
// i work with x.
}
if not how can I free it?
Your pointer points to a managed object (
x) so there is nothing to worry about: the pointer does not need to be freed (or rather, it goes out of scope at the end of thefixedblock) and the pointeexitself is managed by the GC.