Retained memory

Dynamically allocated objects

You cannot store dynamically allocated object in retained memory. Some examples of things that cannot be used:

  • String variables
  • Standard C++ containers such as std::list, std::vector, std:map, etc.
  • Anything that stores data in a separate block on the heap, allocated with new or malloc

You can store string data by allocating a fixed char array in retained variable, but you cannot retain a String.