But what abt the memory which have been sucessfully alocated for CElementsEngine. Who will free this memory if a leave occurs.
Here i am explaining u in a simple exp
Code:
Class String:public CBase
{
public:
string();
private:
char* str1;
char* str2;
};
Code:
string::string()
{
str1 = new char[10];// this allocates sucessfully //Who will free this memory
str2 = new char[888888888]; // it fails and panic raises
}
[/code]
Code:
void main()
{
string* obj = new(ELeave) string(); // this line will panic
//str1 = new char[10];// this allocates sucessfully //Who will free this memory now // who is the owner
}
Therefore in symbian we use lightweight constructors. and make free this memory by cleanupstack methods.
I suggest u to serch wiki for twophase construction and cleanupstack...
Hope this will help to understand..