0

I would like to know if any one can guide me on a particular issue I am facing in a project. Let me first explain you the scenario. We have a project that takes almost 60mbs in memory due to some high quality images we are using. We plan to introduce some small popups at various events in the app, these popups will be animated. We want to allocate no more than 10 mbs for such pops, so far we have explored following options

  1. Imageview animations (very high on memory usage)
  2. Using Movie player to create a small video (however it limits our flexibly and we have to keep a check on video quality)

Now we have some potential options as well, such as

  1. using an animation framework, cocos2d or spritekit. However wouldn't using such a framework for this purpose be an overkill?
  2. Using SWF files by converting them in html5 and than loading in webview. Will this be an efficient way or has some potential side effects?

Any help will be greatly appreciated! Please let me know if any aspect of my question is unclear

Regards

Yasir Munir

muniryasir
  • 109
  • 1
  • 8
  • What is the cause of such high memory consumptions of the popups? Is each popup generated by multiple high resolution images? Anyway, no framework will help you get rid of such memory consumption from images if this is the case. You should consider scaling the images down, tiling, saving the images to some file (could even save them as raw RGB bitmap for very fast loading). – Matic Oblak May 05 '14 at 14:21
  • The memory is not taken by popups, we have implemented a simple uiview and added images on it they take the memory (we have already optimized it as much as possible without deviating further from core requirements), now we wish to add these small animations which have various functionalities, popup is an example. We want to allocate minimum resources for these animations and like to know the best possible solution – muniryasir May 05 '14 at 15:06

2 Answers2

0

I am not understanding how you will use SpriteKit or Cocos2d as popups only. That seems like it will only compound your resource issues, whatever may be the root cause - if you can even get it to work.

I also don't think you are going to save a lot of memory by just choosing another way of doing things. An image has an absolute amount of memory it will use based on dimensions and color bit depth. You say you have optimized the images as much as possible. I wonder though if you could potentially use RGB565 or something and have acceptable quality while saving a lot of memory. With the right dithering options these can look great while being tiny.

Are you bumping up against memory warnings in your testing? I am trying to understand the use case for your memory consumption numbers.

Working with images and wanting very low memory usage are conflicting goals. I would also suggest (because we have very few details to work with) that you look at programs that can convert SVG as code (e.g. paint code). If for example you have logos and graphics that can be done as vectors instead this could be a large savings.

Good luck!

jgnovak-dev
  • 495
  • 3
  • 11
0

The root of your issue is the memory used to hold the decompressed image data before that data is rendered to the view. It does not really have anything to do with the popups. You can find more detailed info and a complete solution at this SO answer. But, to really address this issue you would need to use a framework built to solve this specific memory use problem. SprikeKit, Cocos2D, and CoreGraphics do not address the issue of decompressed memmory usage for very large images. As a result, you can easily crash the program on a real users device by using too much memory for images.

MoDJ
  • 4,309
  • 2
  • 30
  • 65