×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Application crashed at creating of new array of unsigned char. Always.

    Hello, my dear friends!
    I have a strange problem, my application always crashed when I try to create fixed size array of unsigned char.
    For example:
    Code:
    unsigned char* some_name = new unsigned char[360 * 579];
    with that exception:
    Code:
    Thread [Thread id: 706] (Suspended: Signal 'Exception 100' received. Description: Thread 0x2c2 has panicked. Category: ViewSrv; Reason: 11.)	
    	2 Unknown (0x80808080)()  0x80808080	
    	1 Unknown (0x80808080)()  0x80808080
    I tried to increase maximum heap size and stack size via EPOCSTACKSIZE and EPOCHEAPSIZE at MMP file - but without any results.
    If I allocate memory via ChunkHeap, like:
    Code:
    RHeap *pChunkHeap = UserHeap::ChunkHeap(NULL, 360 * 579, 360 * 579 * 2);		 
    TInt size = 360 * 579;
    some_name = (unsigned char*) pChunkHeap->Alloc(size);
    it works for a little, but then crashed again.

    Can you help me with that problem?

    P.S. I have not worked with a C++ for a long long time and maybe I forgot or don't know some tricks (:

    thank you very much for you help and sorry for possible mistakes, english isn't my native or second language.

    Params: Carbide.C++, S60 5th Edition SDK v1.0, GCCE.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Application crashed at creating of new array of unsigned char. Always.

    You can find ViewSrv panics in the documentation (including the on-line one, http://library.forum.nokia.com). It is not the array, but what you are doing with it. You are probably initializing it for a long time, and the OS thinks that your application is frozen.
    Check the Fibonacci examples in the SDK, they show how you can put long running calculations in a secondary thread, or wrap them in an active object (I do not know the exact location of them in S60 5th, they were in Examples\Base\IPC\Async).

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Re: Application crashed at creating of new array of unsigned char. Always.

    Quote Originally Posted by wizard_hu_ View Post
    You can find ViewSrv panics in the documentation (including the on-line one, http://library.forum.nokia.com). It is not the array, but what you are doing with it. You are probably initializing it for a long time, and the OS thinks that your application is frozen.
    Check the Fibonacci examples in the SDK, they show how you can put long running calculations in a secondary thread, or wrap them in an active object (I do not know the exact location of them in S60 5th, they were in Examples\Base\IPC\Async).
    Thanks for answer, but I don't think that I have a problem with long init of array because application crashed exactly at the LOC's when I try to do array = new array[] and never reaches the LOC's where array is populated with data. Also, I run all long calculation code at CPeriodic with 10 seconds interval. And when I told about array = new array[] - I mean that if I comment one place with array = new array[] then Application crashed at next LOC with array = new array[] at another class.

    And errors are different, for example that I have now time:
    Code:
    Thread [Thread id: 906] (Suspended: Signal 'Exception 0' received. Description: A data abort exception has occurred..)	
    	2 Unknown (0x80437B94)()  0x80437b94	
    	1 Unknown (0x80808080)()  0x80808080
    As I can see at "Processes" of "Symbian OS Data" Thread id: 906 that is my CPeriodic thread.

    Could you help me with EPOCSTACKSIZE and EPOCHEAPSIZE? Maybe increasing of this params could help?

    PS Maybe this is important: My application work with camera via CameraWrapper and try to do some math operations to decode QR-Barcodes.
    PPS Of course, I try to use the technique of Fibonacci example, but I doubt that this is the case.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Application crashed at creating of new array of unsigned char. Always.

    Ok, the "data abort exception" is a different thing, usually a KERN-EXEC 3. I was describing the ViewSrv 11 case.
    EPOCHEAPSIZE is a keyword in the .mmp file, it expects you to pass the minimum and maximum heap size your application requires/may need. The .mmp editor of Carbide.c++ also provides a setting field for it, so you can use that one if you like.
    360x579 is around 200 kilobytes. Since the default heap size is 1 megabyte, it should fit (unless you allocate it several times, or have other large arrays). If it is allocated in your periodic stuff, make sure that you also release it.

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Re: Application crashed at creating of new array of unsigned char. Always.

    Quote Originally Posted by wizard_hu_ View Post
    Ok, the "data abort exception" is a different thing, usually a KERN-EXEC 3. I was describing the ViewSrv 11 case.
    EPOCHEAPSIZE is a keyword in the .mmp file, it expects you to pass the minimum and maximum heap size your application requires/may need. The .mmp editor of Carbide.c++ also provides a setting field for it, so you can use that one if you like.
    360x579 is around 200 kilobytes. Since the default heap size is 1 megabyte, it should fit (unless you allocate it several times, or have other large arrays). If it is allocated in your periodic stuff, make sure that you also release it.
    Yes, I just investigate that flags and now set that params:
    Code:
    EPOCSTACKSIZE 0x14000 // 80Kb
    EPOCHEAPSIZE 0x1F4000 0x1F4000 //2Mb
    Now application doesn't crashed, but I'm afraid that big EPOCHEAPSIZE exclude some phone models from application compatibility. So, now I know where is a problem and after some performance optimization try to reduce Heap and Stack size.

    Anyway, many thanks for your help. Now I go to multimedia section with some questions about CameraWrapper and realtime autofocus.
    Have a nice day!

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Application crashed at creating of new array of unsigned char. Always.

    Quote Originally Posted by divenvrsk View Post
    Now application doesn't crashed, but I'm afraid that big EPOCHEAPSIZE exclude some phone models from application compatibility.
    Ah, these are not "Java" devices, but "Symbian". Just visit Devices above, Device specifications, select "S60 3rd edition (initial release)" as filter, and pick some devices from the end of the list (those are the oldest ones, like the 3250, the N91 or the E60). Check Memory functions / Free Executable RAM Memory, even the N91 is expected to have 13 megabytes, which you should not blindly believe, but 2-3 megabytes are definitely not a problem.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Re: Application crashed at creating of new array of unsigned char. Always.

    Quote Originally Posted by wizard_hu_ View Post
    Ah, these are not "Java" devices, but "Symbian". Just visit Devices above, Device specifications, select "S60 3rd edition (initial release)" as filter, and pick some devices from the end of the list (those are the oldest ones, like the 3250, the N91 or the E60). Check Memory functions / Free Executable RAM Memory, even the N91 is expected to have 13 megabytes, which you should not blindly believe, but 2-3 megabytes are definitely not a problem.
    Just visit device specification section, seems it will work at all device that I want.
    I develop for J2ME for four years (: Don't remind me about this.

    Offtopic: To be honest, I think Nokia is very far behind the other players of the mobile market in terms of operating systems and development tools. But I am very glad that they have bought a Trolltech, it should work. Qt - is one of the best tools that I try. And Nokia community is magnificent.

    Thanks for help. I think I'll be back soon (:

Similar Threads

  1. char signed/unsigned
    By salesh in forum Nokia N9
    Replies: 2
    Last Post: 2010-08-06, 20:14
  2. unsigned char * to TDes
    By Kavit Patel in forum Symbian
    Replies: 8
    Last Post: 2008-10-07, 21:35
  3. unsigned char array length
    By bharatuppal in forum Symbian
    Replies: 1
    Last Post: 2007-02-15, 18:01
  4. Unsigned char to CFbsBitmap
    By Lee2 in forum Symbian
    Replies: 2
    Last Post: 2006-08-17, 06:36
  5. unsigned char to hex
    By nicholasgaye in forum Symbian
    Replies: 0
    Last Post: 2005-06-09, 13:14

Posting Permissions

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