too many objects

HI guys,

I have the need to store a big dictionary in one of my classes. The problem is that the compiler is throwing a "too many objects" error when I try to execute the code. It seems there is a limitation for the number of keys in a dictionary. What is the best way to create a huge dictionary that has the following form:

var oDict = {
"DICT_PROP1" => {
"PROP1" => "PROP1_VALUE",
"PROP2" => "PROP2_VALUE",
"PROP3" => "PROP3_VALUE"
},
"DICT_PROP2" => {
"PROP1" => "PROP1_VALUE",
"PROP2" => "PROP2_VALUE",
"PROP3" => "PROP3_VALUE"
},
"DICT_PROP3" => {
"PROP1" => "PROP1_VALUE",
"PROP2" => "PROP2_VALUE",
"PROP3" => "PROP3_VALUE"
},
............
}

I am expecting to have approx. 200 keys in the first level and 4-5 in the second level. I was already thinking about putting the data into the property file, but there I am not allowed to use type dictionary.

Thanks!

Bye
  • Starting with 2.3.1, in the sim's "view memory" you'll see info on objects - current, max, peak. (max varies by the device, BTW). My initial thought is you may not want to use dictionaries, but a bunch of one dimensional arrays or something, and use simple objects for the contents and not complex ones. There are a number of thread here that talk about max object errors and what can be done.
  • Thanks, will take a look at the other posts.

    Bye
  • Former Member
    Former Member
    Based on your description, you have 1800-2200 objects, which is far beyond the current system capacity. The limit for allocated objects in the heap is ~512. Simple elements (Number/Float/Boolean/Char/Symbol/null) do not use an object allocation. You could drastically reduce the number of objects by using an enumeration or Symbols for your keys. You would still be looking at 800-1000 objects if your values need to be strings, so you probably need to look at ways to refactor this information.
  • Based on your description, you have 1800-2200 objects, which is far beyond the current system capacity. The limit for allocated objects in the heap is ~512. Simple elements (Number/Float/Boolean/Char/Symbol/null) do not use an object allocation. You could drastically reduce the number of objects by using an enumeration or Symbols for your keys. You would still be looking at 800-1000 objects if your values need to be strings, so you probably need to look at ways to refactor this information.


    I have solved it in a different way, thanks for the useful information anyways.

    Bye