Is delete useful ?
-
-
In a very long loop (up to 500.000), I have a String^ variable that takes long lengths (and different values) each loop cycle. I wonder if it's worthy to delete the variable at each loop cycle's end; if delete is not used, will the CLR take care of it ?
String is not IDisposable, so there's no point in calling delete. For another thing, you don't need to do that anyway, the GC will appropriately come into play as and when required.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
C++/CLI in Action (*E-Book is out, Print version April 6th*)Fly on your way like an eagle Fly as high as the sun On your wings like an eagle Fly and touch the sun
-
String is not IDisposable, so there's no point in calling delete. For another thing, you don't need to do that anyway, the GC will appropriately come into play as and when required.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
C++/CLI in Action (*E-Book is out, Print version April 6th*)Fly on your way like an eagle Fly as high as the sun On your wings like an eagle Fly and touch the sun