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

Side by Side Diff: third_party/tcmalloc/chromium/src/tests/current_allocated_bytes_test.cc

Issue 9666033: Experiment for updating the tcmalloc chromium branch to r144 (gperftools 2.0). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, Google Inc. 1 // Copyright (c) 2011, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 // before the alloc+free should match the number of bytes used after. 35 // before the alloc+free should match the number of bytes used after.
36 // However, the internal data structures used by tcmalloc will be 36 // However, the internal data structures used by tcmalloc will be
37 // quite different -- new spans will have been allocated, etc. This 37 // quite different -- new spans will have been allocated, etc. This
38 // is, thus, a simple test that we account properly for the internal 38 // is, thus, a simple test that we account properly for the internal
39 // data structures, so that we report the actual application-used 39 // data structures, so that we report the actual application-used
40 // bytes properly. 40 // bytes properly.
41 41
42 #include "config_for_unittests.h" 42 #include "config_for_unittests.h"
43 #include <stdlib.h> 43 #include <stdlib.h>
44 #include <stdio.h> 44 #include <stdio.h>
45 #include <google/malloc_extension.h> 45 #include <gperftools/malloc_extension.h>
46 #include "base/logging.h" 46 #include "base/logging.h"
47 47
48 const char kCurrent[] = "generic.current_allocated_bytes"; 48 const char kCurrent[] = "generic.current_allocated_bytes";
49 49
50 int main() { 50 int main() {
51 // We don't do accounting right when using debugallocation.cc, so 51 // We don't do accounting right when using debugallocation.cc, so
52 // turn off the test then. TODO(csilvers): get this working too. 52 // turn off the test then. TODO(csilvers): get this working too.
53 #ifdef NDEBUG 53 #ifdef NDEBUG
54 size_t before_bytes, after_bytes; 54 size_t before_bytes, after_bytes;
55 MallocExtension::instance()->GetNumericProperty(kCurrent, &before_bytes); 55 MallocExtension::instance()->GetNumericProperty(kCurrent, &before_bytes);
56 free(malloc(200)); 56 free(malloc(200));
57 MallocExtension::instance()->GetNumericProperty(kCurrent, &after_bytes); 57 MallocExtension::instance()->GetNumericProperty(kCurrent, &after_bytes);
58 58
59 CHECK_EQ(before_bytes, after_bytes); 59 CHECK_EQ(before_bytes, after_bytes);
60 #endif 60 #endif
61 printf("PASS\n"); 61 printf("PASS\n");
62 return 0; 62 return 0;
63 } 63 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/tcmalloc.cc ('k') | third_party/tcmalloc/chromium/src/tests/debugallocation_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698