OLD | NEW |
1 // Copyright (c) 2004, Google Inc. | 1 // Copyright (c) 2004, 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 20 matching lines...) Expand all Loading... |
31 // Author: Sanjay Ghemawat | 31 // Author: Sanjay Ghemawat |
32 // | 32 // |
33 // Check that we do not leak memory when cycling through lots of threads. | 33 // Check that we do not leak memory when cycling through lots of threads. |
34 | 34 |
35 #include "config_for_unittests.h" | 35 #include "config_for_unittests.h" |
36 #include <stdio.h> | 36 #include <stdio.h> |
37 #ifdef HAVE_UNISTD_H | 37 #ifdef HAVE_UNISTD_H |
38 #include <unistd.h> // for sleep() | 38 #include <unistd.h> // for sleep() |
39 #endif | 39 #endif |
40 #include "base/logging.h" | 40 #include "base/logging.h" |
41 #include <gperftools/malloc_extension.h> | 41 #include <google/malloc_extension.h> |
42 #include "tests/testutil.h" // for RunThread() | 42 #include "tests/testutil.h" // for RunThread() |
43 | 43 |
44 // Size/number of objects to allocate per thread (1 MB per thread) | 44 // Size/number of objects to allocate per thread (1 MB per thread) |
45 static const int kObjectSize = 1024; | 45 static const int kObjectSize = 1024; |
46 static const int kNumObjects = 1024; | 46 static const int kNumObjects = 1024; |
47 | 47 |
48 // Number of threads to create and destroy | 48 // Number of threads to create and destroy |
49 static const int kNumThreads = 1000; | 49 static const int kNumThreads = 1000; |
50 | 50 |
51 // Allocate lots of stuff | 51 // Allocate lots of stuff |
(...skipping 22 matching lines...) Expand all Loading... |
74 } | 74 } |
75 } | 75 } |
76 delete[] display; | 76 delete[] display; |
77 | 77 |
78 printf("PASS\n"); | 78 printf("PASS\n"); |
79 #ifdef HAVE_UNISTD_H | 79 #ifdef HAVE_UNISTD_H |
80 sleep(1); // Prevent exit race problem with glibc | 80 sleep(1); // Prevent exit race problem with glibc |
81 #endif | 81 #endif |
82 return 0; | 82 return 0; |
83 } | 83 } |
OLD | NEW |