Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/android/purge_ashmem/purge_ashmem.c

Issue 52833002: Purge unpinned ashmem before parsing /proc/$pid/smaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update documentation Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/android/android_tools.gyp ('k') | tools/android/purge_ashmem/purge_ashmem.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/purge_ashmem/purge_ashmem.c
diff --git a/tools/android/purge_ashmem/purge_ashmem.c b/tools/android/purge_ashmem/purge_ashmem.c
new file mode 100644
index 0000000000000000000000000000000000000000..0de582dee3cd274ada512e7cae230149adfb2058
--- /dev/null
+++ b/tools/android/purge_ashmem/purge_ashmem.c
@@ -0,0 +1,20 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "third_party/ashmem/ashmem.h"
+
+int main(void) {
+ const int pages_purged = ashmem_purge_all();
+ if (pages_purged < 0) {
+ perror("ashmem_purge_all");
+ return EXIT_FAILURE;
+ }
+ printf("Purged %d pages (%d KBytes)\n",
+ pages_purged, pages_purged * getpagesize() / 1024);
+ return EXIT_SUCCESS;
+}
« no previous file with comments | « tools/android/android_tools.gyp ('k') | tools/android/purge_ashmem/purge_ashmem.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698