Changeset 41660 in webkit for trunk/JavaScriptCore/wtf/TCSystemAlloc.cpp
- Timestamp:
- Mar 12, 2009, 8:33:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/TCSystemAlloc.cpp
r39809 r41660 382 382 } 383 383 384 #if HAVE(MADV_FREE_REUSE) 385 384 386 void TCMalloc_SystemRelease(void* start, size_t length) 385 387 { 386 #if HAVE(MADV_DONTNEED) 388 while (madvise(start, length, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } 389 } 390 391 #elif HAVE(MADV_DONTNEED) 392 393 void TCMalloc_SystemRelease(void* start, size_t length) 394 { 387 395 if (FLAGS_malloc_devmem_start) { 388 396 // It's not safe to use MADV_DONTNEED if we've been mapping … … 415 423 // NOP 416 424 } 417 return; 418 } 419 #endif 420 421 #if HAVE(MMAP) 425 } 426 } 427 428 #elif HAVE(MMAP) 429 430 void TCMalloc_SystemRelease(void* start, size_t length) 431 { 422 432 void* newAddress = mmap(start, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); 423 433 // If the mmap failed then that's ok, we just won't return the memory to the system. 424 434 ASSERT_UNUSED(newAddress, newAddress == start || newAddress == reinterpret_cast<void*>(MAP_FAILED)); 425 return; 426 #endif 427 428 #if !HAVE(MADV_DONTNEED) && !HAVE(MMAP) 429 UNUSED_PARAM(start); 430 UNUSED_PARAM(length); 431 #endif 432 } 433 434 #if HAVE(VIRTUALALLOC) 435 } 436 437 #else 438 439 // Platforms that don't support returning memory use an empty inline version of TCMalloc_SystemRelease 440 // declared in TCSystemAlloc.h 441 442 #endif 443 444 #if HAVE(MADV_FREE_REUSE) 445 446 void TCMalloc_SystemCommit(void* start, size_t length) 447 { 448 while (madvise(start, length, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { } 449 } 450 451 #elif HAVE(VIRTUALALLOC) 452 435 453 void TCMalloc_SystemCommit(void*, size_t) 436 454 { 437 455 } 438 #endif 456 457 #else 458 459 // Platforms that don't need to explicitly commit memory use an empty inline version of TCMalloc_SystemCommit 460 // declared in TCSystemAlloc.h 461 462 #endif
Note:
See TracChangeset
for help on using the changeset viewer.