×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    77

    Angry Listbox: fully memory problem

    i am creating a list box using the following code

    void CMyContainer::CreateListBoxL()
    {
    iListBox = new ( ELeave ) CAknSingleGraphicStyleListBox();
    iListBox->ConstructL( this,0 );
    iListBox->SetMopParent(this);
    iListBox->SetContainerWindowL(*this);

    itemList = new (ELeave) CDesCArrayFlat(5);
    iconList = new (ELeave) CAknIconArray(5);

    iListBox->Model()->SetItemTextArray( itemList );

    iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconList);
    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );

    iListBox->HandleItemAdditionL();
    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL (CEikScrollBarFrame::EOn,CEikScrollBarFrame::EAuto );


    iListBox->ItemDrawer()->ColumnData()->SetMarqueeParams(100,20,1000000,200000);
    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);

    iSearchField = CAknSearchField::NewL(*this, CAknSearchField::ESearch, NULL, 20);
    STATIC_CAST(CAknFilteredTextListBoxModel*, iListBox->Model())->CreateFilterL(iListBox,iSearchField);
    STATIC_CAST(CAknFilteredTextListBoxModel*, iListBox->Model())->Filter()->HandleOfferkeyEventL();


    iListBox->ActivateL();
    iListBox->DrawNow();

    }

    after creating the List box i have a timer which will add an item into listbox after 1 second and it will continue for 2000 seconds.
    void CMyContainer::AddItem(TInt aIndex,TDesC& aName)
    {

    TBuf<150> item;
    item.Zero();
    item.Num(iListBox->Model()->NumberOfItems());
    item.Append( _L("\t") );
    item.Append(aName));
    itemList->AppendL( item );
    item.Zero();

    CFbsBitmap* aBitmap;
    CFbsBitmap* aMask;
    CGulIcon* aIcon;

    AknIconUtils::CreateIconLC(aBitmap, aMask, iFileName, EMbmicons1,EMbmicons1Mask);
    TSize size;
    AknIconUtils::SetSize(aBitmap, size, EAspectRatioPreserved);
    aIcon = CGulIcon::NewL(aBitmap, aMask);
    aIcon->SetBitmapsOwnedExternally(ETrue);
    iconList->AppendL(aIcon);
    iListBox->HandleItemAdditionL();
    }
    items are being successfully added but afetr adding 500 to 600 items it show "Memory full" message while fone has a lot of free memory, can any body tell me how to resolve the issue??

    Ajmal
    Muhammad Ajmal

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

    Re: Listbox: fully memory problem

    you are propably running out of the heap, thus you could try defining bigger max heap value in your mmp file.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Location
    India, Nashik
    Posts
    816

    Re: Listbox: fully memory problem

    Quote Originally Posted by Ajmal View Post
    i am creating a list box using the following code

    void CMyContainer::CreateListBoxL()
    {
    iListBox = new ( ELeave ) CAknSingleGraphicStyleListBox();
    iListBox->ConstructL( this,0 );
    iListBox->SetMopParent(this);
    iListBox->SetContainerWindowL(*this);

    itemList = new (ELeave) CDesCArrayFlat(5);
    iconList = new (ELeave) CAknIconArray(5);

    iListBox->Model()->SetItemTextArray( itemList );

    iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconList);
    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );

    iListBox->HandleItemAdditionL();
    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL (CEikScrollBarFrame::EOn,CEikScrollBarFrame::EAuto );


    iListBox->ItemDrawer()->ColumnData()->SetMarqueeParams(100,20,1000000,200000);
    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);

    iSearchField = CAknSearchField::NewL(*this, CAknSearchField::ESearch, NULL, 20);
    STATIC_CAST(CAknFilteredTextListBoxModel*, iListBox->Model())->CreateFilterL(iListBox,iSearchField);
    STATIC_CAST(CAknFilteredTextListBoxModel*, iListBox->Model())->Filter()->HandleOfferkeyEventL();


    iListBox->ActivateL();
    iListBox->DrawNow();

    }

    after creating the List box i have a timer which will add an item into listbox after 1 second and it will continue for 2000 seconds.
    void CMyContainer::AddItem(TInt aIndex,TDesC& aName)
    {

    TBuf<150> item;
    item.Zero();
    item.Num(iListBox->Model()->NumberOfItems());
    item.Append( _L("\t") );
    item.Append(aName));
    itemList->AppendL( item );
    item.Zero();

    CFbsBitmap* aBitmap;
    CFbsBitmap* aMask;
    CGulIcon* aIcon;

    AknIconUtils::CreateIconLC(aBitmap, aMask, iFileName, EMbmicons1,EMbmicons1Mask);
    TSize size;
    AknIconUtils::SetSize(aBitmap, size, EAspectRatioPreserved);
    aIcon = CGulIcon::NewL(aBitmap, aMask);
    aIcon->SetBitmapsOwnedExternally(ETrue);
    iconList->AppendL(aIcon);
    iListBox->HandleItemAdditionL();
    }
    items are being successfully added but afetr adding 500 to 600 items it show "Memory full" message while fone has a lot of free memory, can any body tell me how to resolve the issue??

    Ajmal
    Thats right you are running out of heap space and though phone has lot of memory all of that will not be used for your application alone :) , you need to do some trick like dont keep all the items in list box as all of them are not visible at a time load then as and when user scrolls to them.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    187

    Re: Listbox: fully memory problem

    Thks for reply, currently i am using EPOCSTACKSIZE 0x10000 in mmp file. how much i have to increase to resolve this issue.

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

    Re: Listbox: fully memory problem

    you would also need to take care of the Heap size, the stack overflow would actually give you Kern-Exec 3, not memory full error.

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    187

    Re: Listbox: fully memory problem

    i have also given EPOCHEAPSIZE 0x1000 0x100000 in mmp file. but when list items count reached above 600 it stops adding items in list box. and shows memory full error.

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

    Re: Listbox: fully memory problem

    try something bigger, like: EPOCHEAPSIZE 4000 8000000

  8. #8
    Registered User
    Join Date
    May 2008
    Posts
    77

    Re: Listbox: fully memory problem

    thanks yucca thats work :)
    Muhammad Ajmal

Similar Threads

  1. how to display the Listbox
    By arungupta_2jan in forum Symbian
    Replies: 4
    Last Post: 2009-03-03, 21:10
  2. http & outputstream memory problem
    By pillar in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2007-11-09, 13:48
  3. listbox problem
    By sriramadasu in forum Symbian
    Replies: 9
    Last Post: 2006-10-27, 15:27
  4. 6230i memory problem for games and Apps
    By gtasiopoulou in forum Mobile Java General
    Replies: 1
    Last Post: 2005-10-03, 11:55
  5. Problem: Indexes of CDesCArray set to the Listbox.
    By digitaltejas in forum Symbian
    Replies: 2
    Last Post: 2004-08-10, 08:10

Posting Permissions

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