c# - Memory issue in mono touch application -
we have mono touch application contains lots of uiimage
, uiview
objects. when install application (ipa) file in ipad (version1) start working, if continue working 10 20 minutes continuously crashed due low memory.
we tried intruments profile track heap allocations showing memory keep on increasing each screen navigation. disposed allocated objects in viewdiddisappear , though memory not getting decreased. try manually force garbage collector collect garbage through gc.collect(), not working.
is bug in mono touch? or missed memory management techniques?
please me fix low memory warning issue..
thanks
when working uiimage
, uiimageview
should wrap code using
statements or dispose images manually if don't need them anymore. reason managed version of uiimage consists of 4 bytes, pointer memory region holds image data. image unmanaged. means there no pressure on gc because sees managed world. if cannot because need hold image data in memory, you'll need rethink design. ios devices have limited amount of ram , because can apply full power of .net device, doesn't mean should that. try memory citizen.
using(uiimage image = uiimage.fromfile(...)) { // process image. } // here, image data freed.
Comments
Post a Comment