You Are Here:

Community: Wiki

This page was last modified on 7 May 2008, at 15:22.

Granularity

From Forum Nokia Wiki

Contents

Introduction

Granularity is a term that is used in several areas of computing; generally though it refers to the smallest size that can be set or addressed. For example, the granularity of memory determines the smallest amount of data that can be addressed at any one time.

Granularity with subject to Array

It is important to choose an array granularity consistent with the expected usage pattern of the array. If too small a value is used, an overhead will be incurred for multiple extra allocations when a large number of elements are added to the array. However, if too large a granularity is chosen, the array will waste storage space.

Example

// Here Granularity is set to 10
CDesCArrayFlat* Array = new (ELeave) CDesCArrayFlat(10);
CleanupStack::PushL(Array);

If you create an array with a granularity of 10, it means that your array will always have a multiple of 10 elements allocated at any time. Even if you have only one element in your array, memory is already allocated for 10 of them. The reason behind it is that when you add a new element to your array, no memory allocation is needed at that time. If you already have 10 elements in your array and you add one more, the array will be resized to contain 20 elements.

Thus the granularity of an array is quite important in the low-memory mobile application environment. Having a too large granularity will consumes unused memory (which is not a good thing on Symbian), and having a too low granularity will add extra time processing, as well as maybe unnecessary memory reallocation.

Related Links

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fThemesE3aHomeE5fScreenX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ