1) The structure static PTR<CLASS> CLASS::Ptr is created; 2) class is created, new CLASS; it executes constructor CLASS()and CLASS::Ptr is assigned Null 3) CLASS::Tmp value is updated by the pointer to new CLASS 4) Deletes PTR<CLASS> structure CLASS::Ptr; executes destructor, tries to delete CLASS::Ptr (it is Null)
CLASS::Tmp still contains rubbish, not an object address.
Thank you! Somehow I didn't notice this obviousness.
Sergey Dzyublik: 1) A structure static PTR<CLASS> CLASS::Ptr is created; 2) Creates a class, new CLASS; runs constructor CLASS()andCLASS::Ptr is assigned Null 3) CLASS::Tmp value is updated by the pointer to new CLASS 4) Deletes PTR<CLASS> structure CLASS::Ptr; executes destructor, tries to delete CLASS::Ptr (it is Null)
Guys, off topic question, I'm a newbie, would like to order a job, now I have 0 on my balance, can I open a theme? or do I have to top up my account in the beginning? a little confused when they block money from my account...
Probably because you call it manually in the OnStart() function.
Destructors of static objects are called after this function in reverse order of declaration.
Probably because you call it manually in the OnStart() function.
Destructors of static objects are called after this function in reverse order of declaration.
But the leakage does occur. Where is the problem?
I think everything must work correctly here
But the leak is happening. Where is the problem?
You create two objects and delete only one.
Why do you needCLASS::Tmp object?
You create two objects and delete only one.
Where do you create two objects?
Why do you need aCLASS::Tmp object?
Thanks to you there's no need for it anymore. But to understand the language, I'd still like to understand why the example causes leakage.
Hidden objects with hidden constructors are logical in some cases, though (probably the most pervasive one).
Yes, I was mistaken. You have only one object being created and not deleted.
Because when you call the constructor
CLASS() { CLASS::Ptr = CLASS::Tmp; }CLASS::Tmp still contains rubbish, not the address of the object.
2) class is created, new CLASS; it executes constructor CLASS()and CLASS::Ptr is assigned Null
3) CLASS::Tmp value is updated by the pointer to new CLASS
4) Deletes PTR<CLASS> structure CLASS::Ptr; executes destructor, tries to delete CLASS::Ptr (it is Null)
CLASS::Tmp still contains rubbish, not an object address.
Thank you! Somehow I didn't notice this obviousness.
1) A structure static PTR<CLASS> CLASS::Ptr is created;
2) Creates a class, new CLASS; runs constructor CLASS()andCLASS::Ptr is assigned Null
3) CLASS::Tmp value is updated by the pointer to new CLASS
4) Deletes PTR<CLASS> structure CLASS::Ptr; executes destructor, tries to delete CLASS::Ptr (it is Null)
Thank you. But it's not Null, it's trash.
It would be good if the mode
mode would not display arrows from trades (entries/exits). There is no need for them there at all.