Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2010

    Question Symbian Array Efficiency

    Hi all,
    I need to allocate an array of N elements in my program.

    I have gone through and (hopefully) understood the basics of different types of arrays in Symbian:

    My requirements are:

    i) N (number of elements) is some large number known at "runtime".
    ii) Allocation must be done on heap

    Something I would do in normal C++ like:

    int N = get_number_of_elements(.....);
    int *my_array = new int[N];

    In Symbian, it seems to me that:

    1) RArrays - We cannot allocate a chunk of memory at once. The only way is to append "element by element", which may require many "resize" operations on the allocated memory.

    2) TFixedArray - Size must be known at compile time (In my case, N is only known at compile time).

    What is the best way for me to achieve this (rather simple) task of allocating N elements in one shot, where N is known at compile time.

    (Note that I would also prefer to have in-built sort functionality, like in RArrays).

    Thanks for the patience for this rather simple question and your help!


  2. #2
    Registered User
    Join Date
    Jan 2010

    Lightbulb Re: Symbian Array Efficiency

    Hi all,
    For benefit of those reading, I found the solution: we can reserve memory for specified number of elements.

    In class RArray:

    inline TInt Reserve(TInt aCount);
    (Description:: Reserves space for the specified number of elements)


    Link: http://library.forum.nokia.com/index...rrayClass.html


Similar Threads

  1. i am not getting the sprites more than two from array
    By want2win in forum Mobile Java Games
    Replies: 8
    Last Post: 2009-02-13, 07:24
  2. Replies: 1
    Last Post: 2006-09-27, 14:19
  3. Symbian and non Symbian J2ME
    By thongtom in forum Mobile Java General
    Replies: 2
    Last Post: 2005-06-28, 10:52
  4. How Can I Use TSmsUserDataSettings in Symbian 6.1?
    By ilsocio in forum Symbian C++
    Replies: 2
    Last Post: 2003-08-19, 16:39
  5. setting of Series 60 MIDP SDK for Symbian OS version 1.2 for networking
    By servigo in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-07-31, 07:47

Posting Permissions

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