I create an application in WP7 where I have to load up to 20000 hard code data ({'a', 'XYZ'}}
, {'b', 'amano'}, ....) on which I have to search. Therefore, I am trying to do this to make 'A' the key and value as "XYZ". As soon as my dictionary is filled up, this memory gives exception. How can I solve this problem by considering the WP7 application I am creating? Or is there any other way than using the dictionary?
whenever you are loading so much data on Phone You are doing wrong First of all, the bandwidth issue is about to kill your app. Second, the memory issue has already killed your app. Thirdly, the CPU issue is about to kill your app. The conclusion is that your user has finished killing your app. Recommended Solutions: Find a way to classify the data so that you do not download everyone on the phone. Do your processing on the server, where it is related (not on the phone). If you insist on processing so much data on the phone, then try to manage the download size first Remember that you are talking about a mobile phone here, and maximize in every place 3G speeds do not try to include as much data structure as possible (eg using a tree to store common prefixes) Try to zip data before downloading Please. Then count your counter-object memory usage aggressively. You can consume a lot of memory by inserting 20,000 strings and you want to reduce the size of the per-object memory usage as possible. In your example, you are simply putting the stars in there, so I can not guess how you can allow tens of MB on the WP7 app. However, if you are not just printing the wire, but calculate the big objects, bytes. In addition, manage aggressively about operations The last thing you want to do is new dictionary () then
dict.Add (x, y ); In a for-loop, when the internal table space of the dictionary is completed, it is allocated for a new place, and the whole dictionary is copied to the new location, wasting the original location . You have too many fragmented memory spaces to reserve the
new dictionary (20000) or the first place at one place.
Comments
Post a Comment