For me, cli is a novelty, but please explain, I have the simplest code in the timer:

private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { String^ tempString = textBox1->Text; } 

Why does a 4kb / sec leak occur, I don’t understand the local String object ^ do I need to free it or are there any features of cli?

    1 answer 1

    This is managed code, it will free up memory not when you want it, but when the GC works.

    • so what to do? - Duracell
    • @Duracell and wait a little longer - the GC will come and remove everything. Nothing to do - for you, in this case, the CLI thinks. Do not like her care - throw it away and write in normal C ++. - gbg