| OLD | NEW |
| 1 /* Copyright (c) 2009, Google Inc. | 1 /* Copyright (c) 2009, 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 if (total < 10) { | 102 if (total < 10) { |
| 103 FAIL("GetNumericProperty had bad return for generic.current_allocated_bytes"
); | 103 FAIL("GetNumericProperty had bad return for generic.current_allocated_bytes"
); |
| 104 } | 104 } |
| 105 if (!MallocExtension_GetNumericProperty("generic.current_allocated_bytes", | 105 if (!MallocExtension_GetNumericProperty("generic.current_allocated_bytes", |
| 106 &total)) { | 106 &total)) { |
| 107 FAIL("GetNumericProperty failed for generic.current_allocated_bytes"); | 107 FAIL("GetNumericProperty failed for generic.current_allocated_bytes"); |
| 108 } | 108 } |
| 109 MallocExtension_MarkThreadIdle(); | 109 MallocExtension_MarkThreadIdle(); |
| 110 MallocExtension_MarkThreadBusy(); | 110 MallocExtension_MarkThreadBusy(); |
| 111 MallocExtension_ReleaseToSystem(1); | |
| 112 MallocExtension_ReleaseFreeMemory(); | 111 MallocExtension_ReleaseFreeMemory(); |
| 113 if (MallocExtension_GetEstimatedAllocatedSize(10) < 10) { | 112 if (MallocExtension_GetEstimatedAllocatedSize(10) < 10) { |
| 114 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); | 113 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); |
| 115 } | 114 } |
| 116 if (MallocExtension_GetAllocatedSize(x) < 10) { | 115 if (MallocExtension_GetAllocatedSize(x) < 10) { |
| 117 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); | 116 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); |
| 118 } | 117 } |
| 119 | 118 |
| 120 free(x); | 119 free(x); |
| 121 } | 120 } |
| 122 | 121 |
| 123 int main(int argc, char** argv) { | 122 int main(int argc, char** argv) { |
| 124 TestMallocHook(); | 123 TestMallocHook(); |
| 125 TestMallocExtension(); | 124 TestMallocExtension(); |
| 126 | 125 |
| 127 printf("PASS\n"); | 126 printf("PASS\n"); |
| 128 return 0; | 127 return 0; |
| 129 } | 128 } |
| OLD | NEW |