×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    11

    "Memory full" during TCP communication

    Hi,
    I have huge problem with my app.
    At firstthere is some escription of problematic part of my app:
    I have three active classes.
    One called UniversalComm is for making data connection a for connecting TCP socket and if connection is broken there is some integrated mechanism for automatic reconnection.
    Second UniversalTimer is just simple timer. I passed to it pointer to function and then when timer is finished then it calls that passed function.
    Third class ActiveRemoteControl has previous two classes as members. The porpose if this class is to make connection with server (via UniversalComm) and excanged some data. The server periodically sends one little packet to tell phone that data connection is alive. If phone doesnt receive this packet it tries to reconnect.

    The problem is that all is going well until message window appear saying: "MyApp: Memory full. Please close some program and try again".

    I discovered that this has something common with heap size. When i set very small Max. heap size than error message appears sooner.
    If application isnt manipulated and if there are no GSM interuption, the only cycle in application is this cycle for keeping socket connection up: Waiting for any packet from server - Zero packet received - Send zero packet as answer.

    I went through my code manytimes but i didnt discover anything bad. Only New NewL or simmilar constructs Im using are only in constructors which are called only once at start of the application.

    There are some peaces of my code:

    Code:
    UniversalTimer:
    /*
     ============================================================================
     Name		: UniversalTimer.cpp
     Author	  : MK
     Version	 : 1.0
     Copyright   : Your copyright notice
     Description : CUniversalTimer implementation
     ============================================================================
     */
    
    #include "UniversalTimer.h"
    
    CUniversalTimer::CUniversalTimer() :
    	CActive(EPriorityStandard) // Standard priority
    	{
    	}
    
    CUniversalTimer* CUniversalTimer::NewLC()
    	{
    	CUniversalTimer* self = new ( ELeave ) CUniversalTimer();
    	CleanupStack::PushL(self);
    	self->ConstructL();
    	return self;
    	}
    
    CUniversalTimer* CUniversalTimer::NewL()
    	{
    	CUniversalTimer* self = CUniversalTimer::NewLC();
    	CleanupStack::Pop(); // self;
    	return self;
    	}
    
    void CUniversalTimer::ConstructL()
    	{
    	User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
    	CActiveScheduler::Add( this); // Add to scheduler
    	}
    
    CUniversalTimer::~CUniversalTimer()
    	{
    	Cancel(); // Cancel any request, if outstanding
    	iTimer.Close(); // Destroy the RTimer object
    	// Delete instance variables if any
    	}
    
    void CUniversalTimer::DoCancel()
    	{
    	iTimer.Cancel();
    	}
    
    void CUniversalTimer::StartL(TTimeIntervalMicroSeconds32 aDelay, TInt type)
    	{
    	Cancel(); // Cancel any request, just to be sure
    	this->type = type;				//ulozeni typu
    	iState = EUninitialized;
    	iTimer.After(iStatus, aDelay); // Set for later
    	SetActive(); // Tell scheduler a request is active
    	}
    
    void CUniversalTimer::RunL()		
    	{	
    	callBackF(object,type);								//volani callback pri vyprseni		
    	}
    
    TInt CUniversalTimer::RunError(TInt aError)
    	{
    	return aError;
    	}
    
    void CUniversalTimer::SetCallbackFunction(void* obj,void (*callBack)(void* ptObject,TInt))
    	{
    	object = obj;
    	callBackF = callBack;
    	}
    I will be appreciative for every advice.

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    11

    Re: "Memory full" during TCP communication

    Code:
    UniversalComm:
    
    
    
    void CUniversalComm::ConstructL()
    	{
    	FirstTime = true;
    	iaPID = 999;											//pocatecni id pristupoveho bodu
    
    	iDatabase = CCommsDatabase::NewL(EDatabaseTypeISP);		//
    
    	iUTimer = CUniversalTimer::NewL();							//vytvoreni timeru
    	iUTimer->SetCallbackFunction((void*)this,&WrapperTimeout);	//nastaveni callbacku	
    	
    	iPhoneInfo = CPhoneInfo::NewL();							
    	
    	User::LeaveIfError(iSocketServ.Connect());				//pripojeni serveru 
    	User::LeaveIfError(iConnection.Open(iSocketServ)); 		//otevereni spojeni
    	iConnectNotifier = CIAPConnectProgressNotifier::NewL(iStateObserver,iConnection);	//vrazi se spojeni do notifieru
    	CActiveScheduler::Add( this); // Add to scheduler
    	}
    
    CUniversalComm::~CUniversalComm()
    	{
    	Cancel(); // Cancel any request, if outstanding
    	iTimer.Close(); // Destroy the RTimer object
    	User::WaitForRequest(iStatus);
    	iSocket.Shutdown(RSocket::EImmediate,iStatus);
    	User::WaitForRequest(iStatus);
    	// Delete instance variables if any
    	}
    
    void CUniversalComm::DoCancel()
    	{
    	iSocket.CancelAll();
    	iPhoneInfo->Cancel();
    	}
    
    void CUniversalComm::StartL(TTimeIntervalMicroSeconds32 aDelay)
    	{
    	Cancel(); // Cancel any request, just to be sure
    	iState = EConnecting;
    	iTimer.After(iStatus, aDelay); // Set for later
    	SetActive(); // Tell scheduler a request is active
    	}
    
    void CUniversalComm::RunL()
    	{
    	switch (iConnectionState)
    		{
    		case EGetSignal:
    			{
    			iUTimer->Cancel();
    			//pokud je pripojeni pripojeno tak se bud vytoci jen socket nebo se pocka na dalsi pokus pokud je suspended
    			if (IsConnected())
    				{
    				if (IsActive())		
    					{
    					iUTimer->StartL(10000000,EReconnect);							//timeout na pripojeni
    					ConnectSocket();
    					iConnectionState = ESocketOpeningSelf;
    					}
    				else 
    					{
    					iUTimer->StartL(40000000,EReconnect);
    					}
    				}
    			else		//pokud neni pripojeno tak se pokusim o pripojeni
    				{
    				if (iPhoneInfo->GetSignalStrength()>1)		//znovupripojeni jen pri urcite sile signalu
    					{
    					iUTimer->StartL(10000000,EReconnect);
    					}
    				else
    					{
    					iUTimer->StartL(40000000,EReconnect);
    					}
    				}
    			break;
    			}
    		case EConnecting:			//vytocena linka 
    			{																//tak zapocnu ppripojovat socket
    			if (iStatus == KErrNone)
    				{
    				iUTimer->StartL(10000000,EConnecting);							//timeout na pripojeni
    				ConnectSocket();
    				}
    			else
    				{															//start casovace pro znovu pripojeni
    				User::RequestComplete(iStat,KErrCommsLineFail);				//jinak oznamim konec o uroven vyse		
    				iUTimer->StartL(40000000,EReconnect);
    				}
    			break;
    			}			
    		case EConnectingSelf:												//vytocena linka - vnitrni smycka
    			{																//tak zapocnu ppripojovat socket
    			if (iStatus == KErrNone)
    				{
    				iUTimer->StartL(10000000,ESocketOpeningSelf);							//timeout na pripojeni
    				ConnectSocket();
    				}
    			else
    				{															//start casovace pro znovu pripojeni
    				iUTimer->StartL(50000000,EReconnect);
    				}
    			iConnectionState = ESocketOpeningSelf;
    			break;
    			}			
    		case ESocketOpening:												//nepripojeno bez problemu
    			{
    			iUTimer->Cancel();												//vypnuti timeru
    			if (iStatus == KErrNone)
    				{
    				User::RequestComplete(iStat,KErrNone);				//jinak oznamim konec o uroven nize
    				}
    			else
    				{
    				User::RequestComplete(iStat,KErrCommsLineFail);				//jinak oznamim konec o uroven nize		
    				iUTimer->StartL(40000000,EReconnect);
    				}	
    			break;
    			}
    		case ESocketOpeningSelf:												//nepripojeno bez problemu
    			{
    			iUTimer->Cancel();
    			if (iStatus == KErrNone)
    				{
    				callBackF(object,0);											//upozorneni na znovupripojeni
    				}
    			else
    				{
    				iUTimer->StartL(40000000,EReconnect);							//pri chybe zkusit znova
    				}	
    			break;
    			}
    		}
    	}
    
    	
    
    
    void CUniversalComm::ConnectSocket()
    	{
    	iConnection.GetIntSetting(KSetting, iaPID);
    	iConnectionState = ESocketOpening;								//nastaveni na pripojovani socketu
    	if (iTCP)
    	    User::LeaveIfError( iSocket.Open( iSocketServ,					//otevreni TCP socketu
    	    		KAfInet, KSockStream, KProtocolInetTcp, iConnection) );
    	else
    	    User::LeaveIfError( iSocket.Open( iSocketServ,					//otevreni UDP socketu
    	    		KAfInet, KSockDatagram, KProtocolInetUdp, iConnection) );			
        local.SetPort(iPort);											//nastaveni portu
        if( local.Input( iAddress ) == KErrNone )						//nastaveni adresy
            {
            iSocket.Connect(local,iStatus) ;
        	SetActive(); 
           }
    
    	}
    
    void CUniversalComm::ConnectToIpAdress(TRequestStatus& req,TBuf16<32>& aAddr, TInt PortNumber,bool tcp)
    	{
    	iUTimer->StartL(10000000,EConnecting);	//maximalni doba pripojovani
    	iConnection.Close(); 				//zavreni spojeni
    	iTCP = tcp;
    	if (iStateObserver == NULL)
    		{
    		iStateObserver = CIAPConnectStateObserver::NewL();		
    		}
    	if (iConnectNotifier == NULL)
    		{
    		iConnectNotifier = CIAPConnectProgressNotifier::NewL(iStateObserver,iConnection);	//vrazi se spojeni do notifieru
    		}
    	
    	User::LeaveIfError(iConnection.Open(iSocketServ)); 		//otevereni spojeni
    	
    	iPort = PortNumber;
    	iAddress = aAddr;
    	iConnectionState = EConnecting;						//zapocalo pripojovani linky 
    	iStat = &req;										//ulozeni request statusu
    	*iStat = KRequestPending;							//nastaveni jako pending
    	FirstTime = false;
    	iPort = PortNumber;
    	 
    	
    	TCommDbConnPref prefs;
    	if (iaPID == 999)							//pokud pripojuju poprve tak se me to zepta
    		{
    		prefs.SetDirection(ECommDbConnectionDirectionOutgoing);		//odchozi spojeni
    		// otervreni spojeni
    		User::LeaveIfError(iConnection.Open(iSocketServ)); 
    		} else									//jinak nastavim ID predchoziho spojeni
    			{
    			//iConnection.GetIntSetting(KSetting, iaPID);
    			prefs.SetDirection(ECommDbConnectionDirectionOutgoing);		//odchozi spojeni
    			prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);	//nezobrazovat vyzvu
    			prefs.SetIapId(iaPID);
    			// otervreni spojeni
    			User::LeaveIfError(iConnection.Open(iSocketServ)); 
    
    			}
    	//asynchroni vytaceni linky
    	iConnection.Start(prefs,iStatus);
    	
    	SetActive();
    
    	}
    
    
    
    void CUniversalComm::GetConnection (RConnection & conn, RSocket & sock)
    	{
    	sock = iSocket;
    	//conn = iConnection;
    	}
    
    
    TInt CUniversalComm::RunError(TInt aError)
    	{
    	return aError;
    	}
    
    //vrati false pokud neni pripojeno
    TBool CUniversalComm::IsConnected()
    	{
    	TUint numConnection;
    	if (!FirstTime)															//nevolano poprve
    		{
    		User::LeaveIfError(iConnection.EnumerateConnections(numConnection));	//zjisti pocet spojeni
    		if (numConnection == 0 || iConnectNotifier->GetState() == EIAPConnectStateNotConnected)
    			return false;
    		else
    			{
    				return true;
    			}
    		} else
    			return false;
    	}
    
    /**
     *Vrati false pokud neni pripojeno
     */
    
    TBool CUniversalComm::IsActive()
    		{
    		TUint numConnection;
    		if (!FirstTime)															//nevolano poprve
    			{
    			User::LeaveIfError(iConnection.EnumerateConnections(numConnection));	//zjisti pocet spojeni
    			if (numConnection == 0)
    				return false;
    			else
    				{
    				if (iConnectNotifier->GetState() == EIAPConnectStateSuspended)	//pokud neni pripojeno
    					    	{
    					    		return false;  // do nothing
    					    	}
    				else
    						return true;
    				}
    			} else
    				return false;
    		}
    
    
    
    
    void CUniversalComm::GetSocket(RSocket & sock)
    	{
    	sock = iSocket;
    	}
    
    
    
    TUint32 CUniversalComm::GetConID()
    	{
    	return iaPID;
    	}
    
    
    void CUniversalComm::SetConID(TUint32 ID)
    	{
    	iaPID = ID;
    	}
    
    
    void CUniversalComm::TryReconect(TInt type)
    	{
    	iUTimer->StartL(10000000,0);
    	}
    
    void CUniversalComm::WrapperReconnect(void* ptObject, TInt type)
    	{
    	CUniversalComm* obj = (CUniversalComm*) ptObject;
    	obj->TryReconect(type);
    	}
    
    
    
    void CUniversalComm::timeout(TInt type)
    	{
    	switch (type)
    		{
    		case EGetSignal:
    			{
    			BeginReconnect();
    			break;
    			}
    		case  EReconnect:
    			{
    			BeginReconnect();
    			break;
    			}
    		case ESocketOpeningSelf:
    			{
    			iUTimer->StartL(40000,EReconnect);
    			break;
    			}
    		case  EConnecting:
    			{
    			Cancel();
    			User::RequestComplete(iStat,KErrCommsLineFail);
    			BeginReconnect();
    			break;
    			}
    		default:
    			{
    			if (!IsActive())
    				{
    				iState = EReconnect;
    				BeginReconnect();
    				}
    			break;
    			}
    		}
    	}
    
    //wrapper pro callback pro timer
    void CUniversalComm::WrapperTimeout(void* ptObject, TInt type)
    	{
    	CUniversalComm* obj = (CUniversalComm*) ptObject;
    	obj->timeout(type);
    	}
    
    //begin reconnect
    void CUniversalComm::BeginReconnect()
    	{
    	Cancel();
    	iUTimer->StartL(10000000,EGetSignal);
    	iConnectionState = EGetSignal;
    	iPhoneInfo->StartSignalLevel(iStatus);
    	SetActive();
    	}
    
    void CUniversalComm::Reconnect()
    	{
    	iUTimer->StartL(10000000,EReconnect);	//maximalni doba pripojovani
    	iConnectionState = EConnectingSelf;
    	
    	
    	iConnection.Close(); 				//zavreni spojeni	
    	User::LeaveIfError(iConnection.Open(iSocketServ)); 		//otevereni spojeni
    	TCommDbConnPref prefs;
    	if (iaPID == 999)							//pokud pripojuju poprve tak se me to zepta
    		{
    		prefs.SetDirection(ECommDbConnectionDirectionOutgoing);		//odchozi spojeni
    		// otervreni spojeni
    		User::LeaveIfError(iConnection.Open(iSocketServ)); 
    		} else									//jinak nastavim ID predchoziho spojeni
    			{
    			//iConnection.GetIntSetting(KSetting, iaPID);
    			prefs.SetDirection(ECommDbConnectionDirectionOutgoing);		//odchozi spojeni
    			prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);	//nezobrazovat vyzvu
    			prefs.SetIapId(iaPID);
    			// otervreni spojeni
    			User::LeaveIfError(iConnection.Open(iSocketServ)); 
    
    			}
    	//asynchroni vytaceni linky
    	iConnection.Start(prefs,iStatus);
    	iUTimer->StartL(10000000,EConnecting);
    	SetActive();
    	}
    
    void CUniversalComm::SetCallbackFunction(void* obj,void (*callBack)(void* ptObject,TInt))
    	{
    	object = obj;
    	callBackF = callBack;
    	}
    
    void CUniversalComm::CloseConnection()
    	{
    	iSocket.Close();
    	}

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    11

    Re: "Memory full" during TCP communication

    Code:
    RemoteControlActive:
    /*
     ============================================================================
     Name		: RemoteControlActive.cpp
     Author	  : MK
     Version	 : 1.0
     Copyright   : Your copyright notice
     Description : CRemoteControlActive implementation
     ============================================================================
     */
    
    #include "MainStateMachine.h"
    
    
    CRemoteControlActive::CRemoteControlActive() :
    	CActive(EPriorityStandard) // Standard priority
    	{
    	}
    
    CRemoteControlActive* CRemoteControlActive::NewLC(CMainStateMachine* main, SPhoneInfo* PhoneInfo)
    	{
    	CRemoteControlActive* self = new ( ELeave ) CRemoteControlActive();
    	CleanupStack::PushL(self);
    	self->ConstructL(main,PhoneInfo);
    	return self;
    	}
    
    CRemoteControlActive* CRemoteControlActive::NewL(CMainStateMachine* main, SPhoneInfo* PhoneInfo)
    	{
    	CRemoteControlActive* self = CRemoteControlActive::NewLC(main,PhoneInfo);
    	CleanupStack::Pop(); // self;
    	return self;
    	}
    
    void CRemoteControlActive::ConstructL(CMainStateMachine* main, SPhoneInfo* PhoneInfo)
    	{
    	counter = 0;
    	iSPhoneInfo = PhoneInfo;
    	iUTimer = CUniversalTimer::NewL();
    	iUTimer->SetCallbackFunction((void*)this,&WrapperTimeout);	 	//nastaveni callback funkce
    	iUniversalComm = iUniversalComm->NewL();											//komunikacni trida
    	iUniversalComm->SetCallbackFunction((void*)this,&WrapperConnection);			//nastaveni callback pro znovupripojeni
    	
    	iMainState = main;
    	CActiveScheduler::Add( this); // Add to scheduler
    	}
    
    CRemoteControlActive::~CRemoteControlActive()
    	{
    	Cancel(); // Cancel any request, if outstanding
    	iTimer.Close(); // Destroy the RTimer object
    	// Delete instance variables if any
    	}
    
    void CRemoteControlActive::DoCancel()
    	{
    	iUniversalComm->iSocket.CancelAll();
    	//iSocket.CancelAll();
    	}
    
    void CRemoteControlActive::StartL(TRequestStatus& req,TBuf16<32> & aAddr)
    	{
    	Cancel(); // Cancel any request, just to be sure
    
    	iStat = &req;
    	*iStat = KRequestPending;							//nastaveni jako pending
    	iState = EConnecting;
    	iUniversalComm->ConnectToIpAdress(iStatus,aAddr,3013,true);
    	SetActive(); // Tell scheduler a request is active
    	}
    
    void CRemoteControlActive::RunL()
    	{
    	switch (iState)
    		{
    		case EConnecting:								//vyrizeni spojeni
    			{
    			if (iStatus == KErrNone)
    				{
    				SendImei();
    				}
    			else
    				{
    				User::RequestComplete(iStat,KErrCommsLineFail);
    				}
    			break;
    			}
    		case ESendingIMEISelf:				
    			{
    			iUTimer->Cancel();							//vynulovani timeru
    			iUTimer->StartL(10000000,EWaitKeepAlive);
    			SendMining(iMainState->active);				//pri znovupripojeni zaslat stav o aktivite
    			break;
    			}
    		case ESendingIMEI:				
    			{
    			iUTimer->Cancel();							//vynulovani timeru
    			if (iStatus == KErrNone)		//data odeslana v poradku
    				{
    				User::RequestComplete(iStat,KErrNone);
    				}
    			else
    				{
    				User::RequestComplete(iStat,KErrCommsLineFail);	//chyba odeslani
    				}
    			WaitCommand ();
    			break;
    			}
    		case ESending:				
    			{
    			iUTimer->Cancel();							//vynulovani timeru
    			WaitCommand ();
    			break;
    			}
    		case ERecieving:
    			{
    			if (iStatus == KErrNone)		//data prijata v poradku
    				{
    				iUTimer->Cancel();			//prijata data - vynulovani timeru
    				switch (incomingBuff[0])
    					{
    					case EKeepAlive:					//udrzovaci packet
    						{
    						SendKeepAlive();				//odeslani odpovedi
    						break;
    						}
    					case ESwitch:						//prikaz k prepnuti
    						{
    						WaitData();
    						break;
    						}
    					default:
    						break;
    					}
    				}
    			else
    				{
    				iUTimer->StartL(10000000,EWaitKeepAlive);				//pri chybe vyvolat znovu pripojeni
    				break;
    				}
    			break;
    			}
    		case ESwitch:						//ceka se na data prepinace - prepne se a ceka se na novy
    			{
    			iUTimer->Cancel();			//prijata data - vynulovani timeru
    			iMainState->RemoteSwitch((bool)incomingBuff[0]);	//provest prislusnou akci 
    			SendMining((bool)incomingBuff[0]);					//zaslat zpet informaci o zmene stavu mining
    			break;
    			}
    		}
    	}
    
    void CRemoteControlActive::WaitCommand ()
    	{
    
    	iState = ERecieving;
    	iUTimer->StartL(200000000,EWaitKeepAlive);		//timeout na 5 minut do dalsiho keepalive
    	iUniversalComm->iSocket.Read(incomingBuff,iStatus);
    	SetActive();
    	
    	}
    
    void CRemoteControlActive::WaitData()
    	{
    	iState = incomingBuff[0];
    	iUTimer->StartL(10000000,EWaitData);		//timeout na 10 s
     	iUniversalComm->iSocket.Read(incomingBuff,iStatus);
     	SetActive();
    	}
    
    void CRemoteControlActive::SetSockett (RSocket sock)
    	{
    	//iSocket = sock;
    	}
    
    
    TInt CRemoteControlActive::RunError(TInt aError)
    	{
    	return aError;
    	}
    
    
    
    void CRemoteControlActive::SendImei()
    	{
    	iWriteBuffer.SetLength(64);
    	iUTimer->StartL(10000,EWaitKeepAlive);				//timeout pro znovupripojeni pokud se to nepovede
    	iState = ESendingIMEI;
    	TLex imei1(iSPhoneInfo->serialNumber.Mid(0,9));
    	TLex imei2(iSPhoneInfo->serialNumber.Mid(9,6));		//ziskani imei
    	TUint32 imei11;
    	TUint32 imei22;
    	imei1.Val(imei11,EDecimal);
    	imei2.Val(imei22,EDecimal);							//rozebrani na dve casti do int
    	iWriteBuffer[0] = EImei;
    	writeUint32(1,imei11);
    	writeUint32(5,imei22);	
    	iUniversalComm->iSocket.Write(iWriteBuffer, iStatus );
    	SetActive();
    	}
    
    void CRemoteControlActive::SendKeepAlive()
    	{
    	iState = ESending;
    	iWriteBuffer.SetLength(1);
    	iWriteBuffer[0] = EKeepAlive;
    	iUniversalComm->iSocket.Write(iWriteBuffer, iStatus);
    	SetActive();
    	}
    
    void CRemoteControlActive::writeUint32(TInt pos,TUint32 value)
    	{
        for (TInt i = 0; i<4;i++)																//zapis v opacnem poradi
        	{
        	iWriteBuffer[i+pos] = *(((TUint8*)(&value))+(i));			//ulozeni bajt po bajtu
        	}
    	}
    
    void CRemoteControlActive::writeUint64(TInt pos,TUint32 value)
    	{
        for (TInt i = 0; i<4;i++)																//zapis v opacnem poradi
        	{
        	iWriteBuffer[i+pos] = *(((TUint8*)(&value))+(i));			//ulozeni bajt po bajtu
        	}
    	}
    
    //callback na timeout
    void CRemoteControlActive::timeout(TInt type)
    	{
    	switch (type)
    		{
    		case EWaitData:										//zruseni prijmu dat pri dlouhe prodleve
    			{
    			Cancel();							//zrusit poslech
    			WaitCommand();									//cekat na prikaz
    			break;
    			}
    		case EWaitKeepAlive:
    			{
    			Cancel();
    			iUniversalComm->BeginReconnect();					//odpojeni spojeni - znovupripojeni
    			break;
    			}
    		}
     	}
    
    //wrapper pro callback
    void CRemoteControlActive::WrapperTimeout(void* ptObject, TInt type)
    	{
    	CRemoteControlActive* obj = (CRemoteControlActive*) ptObject;
    	obj->timeout(type);
    	}//callback na timeout
    
    void CRemoteControlActive::connection(TInt type)
    	{
    	Cancel();
    	SendImei();
    	iState = ESendingIMEISelf;
     	}
    
    //wrapper pro callback
    void CRemoteControlActive::WrapperConnection(void* ptObject, TInt type)
    	{
    	CRemoteControlActive* obj = (CRemoteControlActive*) ptObject;
    	obj->connection(type);
    	}
    
    //nastaveni callbacku od dataconnection
    void CRemoteControlActive::SetCallbackFunction(void* obj,void (*callBack)(void* ptObject,TInt))
    	{
    	object = obj;
    	callBackF = callBack;
    	}
    
    //odeslani informace o zmene prepnuti
    bool CRemoteControlActive::SendMining(bool onoff)
    	{
    	if (Busy())
    		{
    		return false;
    		}
    	Cancel();								//zrusit stavajici akce
    	iState = ESending;
    	iWriteBuffer.SetLength(2);
    	iWriteBuffer[0] = EMining;
    	iWriteBuffer[1] = onoff;
    	iUniversalComm->iSocket.Write(iWriteBuffer, socketStatus );
    	SetActive();
    	return true;
    	}
    
    //zaneprazdnenost
     bool CRemoteControlActive::Busy()
    	 {
    	 if (iState==ESending || iState==ESendingIMEI || iState==ESendingMining)
    		 {
    		 return true;
    		 } else return false;
    	 }
     
     void CRemoteControlActive::SetAutoCon(TInt iapid)
    	 {
    	 iUniversalComm->SetConID(iapid);
    	 }
     
     TUint32 CRemoteControlActive::GetConId()
    	 {
    	 return iUniversalComm->GetConID();
    	 }

  4. #4
    Nokia Developer Champion
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: "Memory full" during TCP communication

    1. you can use HookLogger catch the memory leak.
    2. in your destruct, it not clean the member field. like CUniversalComm's iPhoneInfo, iDatabase...
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    11

    Re: "Memory full" during TCP communication

    I know that I propably havent all structures deleted in destructor but I create this class only once and is destroyed at app exit so this is not relevant with my error. I will try hooklogger but i have problem with running my app under the emulator so Im not sure that it will be helpfull.

Similar Threads

  1. Communication - TCP UDP
    By dodil in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2008-10-10, 22:51
  2. Getting "Memory full" when I start S60 emulator.
    By prem.srini in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2007-11-20, 15:47
  3. "Memory full" on installing app on 3650
    By Stengun in forum Mobile Java General
    Replies: 0
    Last Post: 2004-04-26, 23:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •