Why "__UHEAP_FAILNEXT" doesn't work in UIQ??

Login to reply to this topic.
Mon, 2007-04-23 12:41
Joined: 2006-07-26
Forum posts: 27
I tried the following code in both S60 3rd SDK and UIQ3 SDK:

void CabcdefgAppView::ConstructL( const TRect& aRect )
{
        __UHEAP_MARK;   
   
        __UHEAP_FAILNEXT(3);
        TRAPD( err, DoSth() );
        if( err != KErrNone )
        {
   TInt e = err;
        }   
      
        __UHEAP_MARKEND;
        __UHEAP_RESET;
}

void CabcdefgAppView::DoSth()
{
   for( TInt i = 0; i < 10; i++ )
   {      
      HBufC* buf;   
      buf = HBufC::NewLC( 100 );      
      CleanupStack::PopAndDestroy();
   }
}


__UHEAP_FAILNEXT(3); will cause the memroy allocation leave in S60 3rd just as I expected. But in UIQ3 SDK, I can't see any leave. The return value of TRAPD( err, DoSth() ); is KErrNone, which is 0.

I tried to press ctrl+alt+shift+p to do some setting in UIQ emulator, but it either didn't make sense or I didn't set it right.

Did I miss something??

Thank you in advance.

Huh Huh Huh Huh

Taking you forward.


Tue, 2007-04-24 09:13
Joined: 2004-05-21
Forum posts: 285
Re: Why "__UHEAP_FAILNEXT" doesn't work in UIQ??
I only thing which I could think of is that you are building for urel instead of udeb. Remember that these macro work only in debug version.

One more thing is DoSth should be DoSthL according to Symbian standard as it is a leaving function.


Cheers,
Sri
Tue, 2007-04-24 09:59
Joined: 2006-07-26
Forum posts: 27
Re: Why "__UHEAP_FAILNEXT" doesn't work in UIQ??
1. I'm sure I was building a udeb version

2. I agree I should modify the function name to DoSthL

Did anybody else try this before?

Taking you forward.

Tue, 2007-04-24 15:49
Joined: 2004-11-29
Forum posts: 1155
Re: Why "__UHEAP_FAILNEXT" doesn't work in UIQ??
Sounds weird that it wouldn't work.

These are used a lot by anyone that writes symbian code professionally.

I havn't used UIQ3 though.

You could always try to skip useing the macro and use the function calls directly.

User::Heap().__DbgMarkStart()
User::Heap().__DbgMarkEnd(..);
and
User::Heap().__DbgSetAllocFail(...)

Tue, 2007-04-24 16:48
Joined: 2004-07-10
Forum posts: 364
Re: Why "__UHEAP_FAILNEXT" doesn't work in UIQ??
"I tried to press ctrl+alt+shift+p to do some setting in UIQ emulator, but it either didn't make sense or I didn't set it right."

Why do you think this has go anything to do with it?
Tue, 2007-05-01 06:05
Joined: 2006-07-26
Forum posts: 27
Re: Why "__UHEAP_FAILNEXT" doesn't work in UIQ??
Alright, I found the reason. If I use CodeWarrior 3.1, then this marco won't work. Then I switch to MS VS 2003.net, then it came.

Some one tell me why?

Taking you forward.

  • Login to reply to this topic.