| 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); |
| 111 MallocExtension_ReleaseFreeMemory(); | 112 MallocExtension_ReleaseFreeMemory(); |
| 112 if (MallocExtension_GetEstimatedAllocatedSize(10) < 10) { | 113 if (MallocExtension_GetEstimatedAllocatedSize(10) < 10) { |
| 113 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); | 114 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); |
| 114 } | 115 } |
| 115 if (MallocExtension_GetAllocatedSize(x) < 10) { | 116 if (MallocExtension_GetAllocatedSize(x) < 10) { |
| 116 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); | 117 FAIL("GetEstimatedAllocatedSize returned a bad value (too small)"); |
| 117 } | 118 } |
| 118 | 119 |
| 119 free(x); | 120 free(x); |
| 120 } | 121 } |
| 121 | 122 |
| 122 int main(int argc, char** argv) { | 123 int main(int argc, char** argv) { |
| 123 TestMallocHook(); | 124 TestMallocHook(); |
| 124 TestMallocExtension(); | 125 TestMallocExtension(); |
| 125 | 126 |
| 126 printf("PASS\n"); | 127 printf("PASS\n"); |
| 127 return 0; | 128 return 0; |
| 128 } | 129 } |
| OLD | NEW |