Memory usage

I'm developing an app (watch face for FR645) and having a few problems with memory usage. It seems that when an HTTP GET returns with too large a JSON, the app crashes ("Encountered an app crash") - no stack trace, no exception, nothing. As someone with a C++ background, I'm quite surprised at this behavior. Now, I know people make apps that display a lot of weather data, which is only accessible through large JSONs. It appears that a number of the open source projects use an independent website to forward the HTTP request to the weather website, parse it down to a manageable size, and return it. At best, this only reduces the size by about 50%, which doesn't seem all that substantial. My questions are:

1. Is it standard to use an independent website for HTTP requests?

2. Is there a better way to handle the memory usage so it doesn't go over?

3. Is there a way to check how much memory is left available?

I'd appreciate your thoughts.

  • And when it comes to makeWebRequests(), the data is received in JSON format, and it needs to be converted to a dictionary, which can really increase the size depending on the complexity (consider at least double while the conversion is taking place).

    It appears (to me) that the size of the JSON "blob" that can be processed has a different limit. One that is much smaller (typically) than the available main memory.

  • If you're doing the makeWebRequest in a background service, the memory is definitely smaller and limited to the max size a background can be.  And the max size of the "blob" depends on the complexity of the data.