×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Any way to extend memory on nokia E52

    i have a wierd problem. App doesn't start when i add to code:
    Code:
    TFillFrame TMobEyeFrameBuff[40];

    where
    Code:
    const int aFrameW = 240;
    const int aFrameH = 180;
    const int aFrameLen = aFrameW * aFrameH * 4;
    
    struct TFillFrame {
    	
    public:
    int 	* filled;
    TUint8  * pdata;	
    int fillPixelCount;
    float BaseAngle;
    bool accepted;
    TFoundObject * FirstObject;
    TFillFrame();
    ~TFillFrame();
    void DeleteObjectsIfPersist();
    
    void Reset();
    	
    
    private:
    int actR;
    int actG;
    int actB;
    };
    
    
     TFillFrame::TFillFrame()
    	 {
    	TPoint px = TPoint(0,0);
    
    		
    		pdata 	= new TUint8[aFrameLen];
    		filled 	= new int[aFrameLen];
    
    		Reset();
    		FirstObject = new TFoundObject();
    	 }
    
    
    
    TFoundObject::TFoundObject()
    	{
    
    pdata = new TUint8[aFrameW * aFrameH * 4];
    int i; int ai;
    for (i=0; i < aFrameW * aFrameH * 4; i++) 
    	{ 
    ai = y2x(90)+120*4;
    pdata[ai+0] = 0;   // b
    pdata[ai+1] = 0;   // g
    pdata[ai+2] = 0;   // r
    pdata[ai+3] = 255; //Unused - default at 255;
    	}
    next = NULL;
    prev = NULL;
    blank = true;
    	}

    I think its because of low memory, but i have around 40 MB of free (RAM?)
    maybe this is the problem but i need TFoundObject to return bitmap for debuggin purposes.

    TFillFrame TMobEyeFrameBuff[40]; without TFoundObject - app won't start

    TFillFrame TMobEyeFrameBuff; without TFoundObject - app will start

    everything else won't start ;]


    So maybe its the low memory problem, i have a task manager installed on the phone but i can have only this 40 MB of memory free - rest is used by system apps, if i could only know what i could close)




    TFoundObject is a struct that has its own constructor and destructor too.
    Last edited by melepeta; 2013-11-20 at 22:12.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Any way to extend memory on nokia E52

    it propably starts, but does crash during the star, thus do check the panic code for the crash: http://developer.nokia.com/Community...ded_panic_code

    Also it might be good idea to check the code line causing the crash. anyway if it is really related to TFoundObject usage, then it could be stack overrun, so do increase the stack size in your mmp file, here's wiki link for help: http://developer.nokia.com/Community/Wiki/MMP_file

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Any way to extend memory on nokia E52

    It might be safer to use Symbian C++ approach.
    Inherit from CBase, and call the things CFillFrame, CFoundObject
    - T-objects are supposed to be value types, storing values on a fixed amount of memory which is allocated in a single step (like simple numbers, TInt, TReal, etc., a couple numbers, TRgb, TSize, TRect, etc., a couple characters, TBuf<30>, etc.). They are not supposed to own heap-based objects or resources (practically: no pointers inside), and they can not be guarded by the Cleanup Stack. Normally they do not need and have destructors.
    - C-objects are free to own other objects, be on the heap, have destructors, and they can be protected by the Cleanup Stack efficiently. A convenient side effect is that whatever you inherit from CBase, will be filled with zeroes when you instantiate it. So you would not need the "next = NULL;" lines, and you can not forget zeroing the members. Also, as size of C-objects is not limited by the stack, you could simply have a direct TUint8 pdata[240*180*4] member, without the need of extra initialization and release steps.
    Of course then you would have to create the CXy objects on the heap, with explicit new/new(ELeave) calls.

  4. #4
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: Any way to extend memory on nokia E52

    Check the maximum EPOCHEAPSIZE defined in the project's MMP file. If I remember correctly, the default value set by older Symbian SDKs was quite low (might have only been one megabyte) - just the data arrays allocated by the 40 TFillFrames probably exceed that limit already.

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Any way to extend memory on nokia E52

    TongMuang, the T-Classes are put into the Stack, not Heap in general. thus increasing stack would generally be better idea..

  6. #6
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: Any way to extend memory on nokia E52

    Quote Originally Posted by symbianyucca View Post
    TongMuang, the T-Classes are put into the Stack, not Heap in general. thus increasing stack would generally be better idea..
    Well, it doesn't help in this case, because the "T structs" in original post allocate a lot of heap memory in their constructors:

    Code:
     TFillFrame::TFillFrame()
    	 {
    	TPoint px = TPoint(0,0);
    
    		
    		pdata 	= new TUint8[aFrameLen];
    		filled 	= new int[aFrameLen];
    Code:
    TFoundObject::TFoundObject()
    	{
    
    pdata = new TUint8[aFrameW * aFrameH * 4];

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Any way to extend memory on nokia E52

    I think we could wait for the panic code. It will tell us if KERN-EXEC 3, or KErrNoMemory, or something else is the problem.

  8. #8
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Any way to extend memory on nokia E52

    Well i increased stack size by about 3, now its about 5,8 MB) now it's 0xF000
    I also disabled camera that i could run app on emulator, but it stills acts like on device - that means app does not start. (no panic or other errors shown)

    I want to try what wizard_hu told me to inherit it from CBase, but i am not quite sure if i should make 2 stage constructor for it? (you know newl and newlc) I ask because i am tired now and i want to go sleep ;] If yes, then i will try it and tell the result.


    Oh and about these T or C naming well i was teaching programming myself so i just name classes and structures by T ;]

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Any way to extend memory on nokia E52

    I would suggest that you do try the panic code once again. There are no situations where a simple code change would make the application 'not to start', I'm 99.99 certain it starts and crashes. The Y-Tasks I have made would be nice way on getting all exit codes, even the 'normal' ones for all processes started. So try it in the device.

  10. #10
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Any way to extend memory on nokia E52

    It says 'kill -4' so i was right not enough memory ;x

    but with single TFillFrame and single TFillObject it shoul;dnt exceed since 240 * 180 * 4 * 2 = 337,5 kB

    and i have 128 MB of RAM, but free is only omg 40 MB
    Last edited by melepeta; 2013-11-22 at 13:05.

  11. #11
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Any way to extend memory on nokia E52

    Basically there is a limit set by the EPOCHEAPSIZE , which I suppose limits the max to 1 or 2 Mb, so if you need more, you need to define bigger one in your mmp file

  12. #12
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Any way to extend memory on nokia E52

    Yes, that worked, now i must modify TFoundObject because if i find more objects in one frame it will crash.

    Thank you.
    Last edited by melepeta; 2013-11-22 at 14:06.

Similar Threads

  1. About c extend py
    By yyn in forum Symbian
    Replies: 6
    Last Post: 2008-12-14, 14:35
  2. How to extend a file?
    By zhangwei_Nirvana in forum Open C/C++
    Replies: 1
    Last Post: 2008-03-02, 07:49
  3. How can I extend the module on s60-3rd?
    By yanhua in forum Symbian
    Replies: 0
    Last Post: 2007-09-13, 13:11
  4. Dita Direct transfer to Memory Card (not phone memory)-nokia 6270
    By sharmavijay78 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 0
    Last Post: 2007-07-15, 10:12
  5. nokia 3300 - move files from memory card to phone memory
    By ned_21 in forum Mobile Java General
    Replies: 0
    Last Post: 2003-12-30, 03:51

Posting Permissions

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