Note that there are some explanatory texts on larger screens.

plurals
  1. PODelay iOS app termination due to low memory condition
    primarykey
    data
    text
    <p>I'm developing a linguistic app that, occasionally, needs to allocate a large amount of memory for a certain period of time (normally under 30 seconds). Unfortunately, iOS sends low memory warnings and sometimes terminates the app (roughly 5% of the times). Of course I can't rely on chance so I have to fix it. I'm trying to optimize the algorithm (it's basically looking for spelling and sound similarities using Levenshtein distance) but I'm afraid that using the file system instead of the memory would make the processing too slow. Is there any way to respond to low memory warnings if I know that the memory will be released soon? Any other suggestions?</p> <p>A few details:</p> <ol> <li>the core processing is done in the background in an NSOperation</li> <li>the algorithm is written in C++ for performance reasons, and it uses C++ strings and mallocs. </li> <li>the same algorithm ported to Objective-C is 10x slower, even though I haven't investigated the reasons</li> <li>the app is not leaking memory. After the long processing, all the memory is properly released</li> <li>the app is iPad only</li> </ol> <p>EDIT: the bulk of the storage is a C++ vector with about 200K English words. I have to compare these words with some potential candidates for both spelling and phonetic similarities. For each candidate I have to iterate through the whole list of words and calculate Levenshtein Distance. The distance is calculated using a similarity matrix which statically allocated in a function. I'm still puzzled at why I start with a vocabulary which is about 2 MB and end up with 70+ MBs of live bytes during the processing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload