| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // The memory use computed this way is not entirely accurate and depends on | 408 // The memory use computed this way is not entirely accurate and depends on |
| 409 // the way malloc allocates memory. That's why the memory use may seem to | 409 // the way malloc allocates memory. That's why the memory use may seem to |
| 410 // increase even though the sum of the allocated object sizes decreases. It | 410 // increase even though the sum of the allocated object sizes decreases. It |
| 411 // also means that the memory use depends on the kernel and stdlib. | 411 // also means that the memory use depends on the kernel and stdlib. |
| 412 static intptr_t MemoryInUse() { | 412 static intptr_t MemoryInUse() { |
| 413 intptr_t memory_use = 0; | 413 intptr_t memory_use = 0; |
| 414 | 414 |
| 415 int fd = open("/proc/self/maps", O_RDONLY); | 415 int fd = open("/proc/self/maps", O_RDONLY); |
| 416 if (fd < 0) return -1; | 416 if (fd < 0) return -1; |
| 417 | 417 |
| 418 const int kBufSize = 10000; | 418 const int kBufSize = 20000; |
| 419 char buffer[kBufSize]; | 419 char buffer[kBufSize]; |
| 420 ssize_t length = read(fd, buffer, kBufSize); | 420 ssize_t length = read(fd, buffer, kBufSize); |
| 421 intptr_t line_start = 0; | 421 intptr_t line_start = 0; |
| 422 CHECK_LT(length, kBufSize); // Make the buffer bigger. | 422 CHECK_LT(length, kBufSize); // Make the buffer bigger. |
| 423 CHECK_GT(length, 0); // We have to find some data in the file. | 423 CHECK_GT(length, 0); // We have to find some data in the file. |
| 424 while (line_start < length) { | 424 while (line_start < length) { |
| 425 if (buffer[line_start] == '\n') { | 425 if (buffer[line_start] == '\n') { |
| 426 line_start++; | 426 line_start++; |
| 427 continue; | 427 continue; |
| 428 } | 428 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 | 480 |
| 481 TEST(RegressJoinThreadsOnIsolateDeinit) { | 481 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 482 intptr_t size_limit = ShortLivingIsolate() * 2; | 482 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 483 for (int i = 0; i < 10; i++) { | 483 for (int i = 0; i < 10; i++) { |
| 484 CHECK_GT(size_limit, ShortLivingIsolate()); | 484 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 #endif // __linux__ and !USE_SIMULATOR | 488 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |