English 中文(简体)
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 could 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.)

问题回答

暂无回答




相关问题
Passing a pointer to a char array to a function

I have a pointer to my char array like this. unsigned char *recvBuf; recvBuf = (unsigned char *)malloc(sizeof(char)*RECVBUF); I then pass that to a function defined as void setHeader(...

Function pointer as an argument

Is it possible to pass a function pointer as an argument to a function in C? If so, how would I declare and define a function which takes a function pointer as an argument?

Issue with scope and closures in JavaScript

My question is really more about scope in JavaScript, rather then closures. Let s take the following code: var f = function () { var n = 0; return function () { return n++; }; }()...

Refactoring function pointers to some form of templating

Bear with me as I dump the following simplified code: (I will describe the problem below.) class CMyClass { ... private: HRESULT ReadAlpha(PROPVARIANT* pPropVariant, SomeLib::Base *b); HRESULT ...

C++ Using Class Method as a Function Pointer Type

In a C lib, there is a function waiting a function pointer such that: lasvm_kcache_t* lasvm_kcache_create(lasvm_kernel_t kernelfunc, void *closure) where lasvm_kernel_t is defined as: typedef ...

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:...

热门标签