Freeing memory after string concatenation
    Alex 
    a_bothe at gmx.net
       
    Tue Dec 23 10:28:03 PST 2008
    
    
  
Hey,
I got a problem after concatenating two strings:
void main()
{
       while(true) // For faking high program activity...
       {
             string t="Do";
             string t2="That"
             
             foo(t,t2);
             delete t;
             delete t2;
       }
}
void foo(string s1, string s2)
{
       string con=s1~s2;
       writeln(con);
       delete con;
}
until now, there seems everything to be ok but now I want to make my program run most efficiently...
I looked at the memory usage with the TaskManager
I found that 'con' did not get removed! (the memory usage grew up very fast after several repeations)
Why?
    
    
More information about the Digitalmars-d-learn
mailing list