+1

Tips on memory management

Richard Lindley 12 aastat tagasi uuendaja icahill (Administrator) 12 aastat tagasi 5
Do you have any best practices to handle memory especially given the iPad 1 is fairly limited.

Is there a way you can check available memory remaining? At the moment, it's only when my app crashes after loading a bunch of assets that I find out that it has run out of memory.

With a 'static' type app it is easy to find the limit and dial it back - with a dynamic app created with datasources it is not so easy to monitor as you can't be sure what is in the datafeed.

Any tips?
Richard,

If you have X-Code installed on your machine, then you can use an app called "Instruments." Make sure your device is connected and launch Instruments. Select "Activity Monitor" and you'll be able to watch the memory usage as you go through the app.
Thanks, but I develop on a PC! Not quite the sort of answer I was looking for although I realise it's quite a broad question.

I have some more specific memory questions then:

Does downloading an image (using download) use the full memory of the image or does it stream into storage?

When loading an image, does suppress=yes load the image into memory then unload it?

Does assigning the property suppress=yes unload an image if it is already loaded?

Does changing the source property on an image unload the previous image and load the new image? or should you use unload, then load?

If I change an image with load, does it unload the previous image and release the memory?

If you create an image using the URL parameter and then later assign a new image using source, does the memory get released for the URL image?
Ok let's see if I can't answer these:

Does downloading an image (using download) use the full memory of the image or does it stream into storage?

Not sure what you mean by stream into storage, but the download tag does store the full version of the image in the applications folder of the app, so you can retrieve it and use it at anytime within the app.

When loading an image, does suppress=yes load the image into memory then unload it?

The image tag suppress attribute tells the engine to reserve the geometry for the image, but to not actually load the image content. You can then use the load tag action to bring in the content whenever you want.

Does assigning the property suppress=yes unload an image if it is already loaded?

Suppress is not an assignable object property.

Does changing the source property on an image unload the previous image and load the new image? or should you use unload, then load?

If you assign a new image to the same tag, it will unload the old image and replace it with the new image. However if the image is not coming from a URL, then it is still stored in the app even if it is not loaded into memory, it still takes up space in the project.

If you create an image using the URL parameter and then later assign a new image using source, does the memory get released for the URL image?

Only the current source/url will take the memory hit and you can't have both types on the same image tag. You would need to use two image tags to achieve this scenario.
Thanks, I'm trying to manage working memory with image. With the last question, I am looking at loading an image immediately via a URL and later replacing it with one I have downloaded with the download tag. I just wanted to make sure all of this image swapping is handled by the engine and I don't have to explicitly release the memory before loading a new image.

One last question then, is once the wire engine is loaded, approx how much memory is there available?
Obviously depending on the device you are running on, RareWire apps run at around 5% of the device memory.