Skip to content

Instantly share code, notes, and snippets.

@BalestraPatrick
Created March 15, 2014 11:47
Show Gist options
  • Select an option

  • Save BalestraPatrick/9565789 to your computer and use it in GitHub Desktop.

Select an option

Save BalestraPatrick/9565789 to your computer and use it in GitHub Desktop.
Easily calculate the bytes used in your Pebble app with the Persistent Storage API. The maximum memory you can use is 4kb.
int totalSize = 0;
// Adjust the value (in this example: 2000) to your maximum key that you know you're using in your app
for (int i = 0; i < 2000; i++) {
if (persist_exists(i)) {
int size = persist_get_size(i);
totalSize = totalSize + size;
}
}
APP_LOG(APP_LOG_LEVEL_DEBUG, "Persistent storage used = %d", totalSize);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment