开发者

Memory full on calling a method through its method pointer

I have a method pointer like below:

typedef void (MMsnInternalCallBacks::* FuncPtr)();
FuncPtr iSoapActionComplete;        

I call the method below through the pointer iSoapActionComplete like below:

(iCallbacks.*iSoapActionComplete)( );

While the function is being called a message "Memory Full. Try closing some applications" flashes on my Symbian S60 3rd Ed emulator.

Any idea why this co开发者_如何转开发uld be happening.


Does the function work if it's not being called through a method pointer but directly?

A likely cause for the message is that the function is leaving with KErrNoMemory i.e. -4 and the leave is caught by the application framework trap harness, resulting in an appropriate dialog.

Such a leave occurs for example when operator new(TLeave) fails to allocate memory or a zero argument is passed to User::LeaveIfNull(). Sometimes you can even see explicit User::Leave(KErrNoMemory) calls.

You can TRAP() the callback function call to catch leaves yourself. Better yet, you should fix the function itself to not to leave in normal sunny day scenarios.

(Also, by convention, leaving functions have the L suffix. Since you're using the i prefix for instance data, you are probably aware of the Symbian C++ naming conventions.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜