Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: src/platform-openbsd.cc

Issue 8060052: Fix leakage of virtual address space on Linux platform. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2011 the V8 project authors. All rights reserved. 1 // Copyright 2006-2011 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 fclose(file); 238 fclose(file);
239 return NULL; 239 return NULL;
240 } 240 }
241 void* memory = 241 void* memory =
242 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); 242 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
243 return new PosixMemoryMappedFile(file, memory, size); 243 return new PosixMemoryMappedFile(file, memory, size);
244 } 244 }
245 245
246 246
247 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 247 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
248 if (memory_) munmap(memory_, size_); 248 if (memory_) OS::Free(memory_, size_);
249 fclose(file_); 249 fclose(file_);
250 } 250 }
251 251
252 252
253 static unsigned StringToLong(char* buffer) { 253 static unsigned StringToLong(char* buffer) {
254 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT 254 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT
255 } 255 }
256 256
257 257
258 void OS::LogSharedLibraryAddresses() { 258 void OS::LogSharedLibraryAddresses() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 VirtualMemory::VirtualMemory(size_t size) { 335 VirtualMemory::VirtualMemory(size_t size) {
336 address_ = mmap(NULL, size, PROT_NONE, 336 address_ = mmap(NULL, size, PROT_NONE,
337 MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, 337 MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
338 kMmapFd, kMmapFdOffset); 338 kMmapFd, kMmapFdOffset);
339 size_ = size; 339 size_ = size;
340 } 340 }
341 341
342 342
343 VirtualMemory::~VirtualMemory() { 343 VirtualMemory::~VirtualMemory() {
344 if (IsReserved()) { 344 if (IsReserved()) {
345 if (0 == munmap(address(), size())) address_ = MAP_FAILED; 345 OS::Free(address(), size());
346 address_ = MAP_FAILED
346 } 347 }
347 } 348 }
348 349
349 350
350 bool VirtualMemory::IsReserved() { 351 bool VirtualMemory::IsReserved() {
351 return address_ != MAP_FAILED; 352 return address_ != MAP_FAILED;
352 } 353 }
353 354
354 355
355 bool VirtualMemory::Commit(void* address, size_t size, bool executable) { 356 bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 794
794 795
795 void Sampler::Stop() { 796 void Sampler::Stop() {
796 ASSERT(IsActive()); 797 ASSERT(IsActive());
797 SignalSender::RemoveActiveSampler(this); 798 SignalSender::RemoveActiveSampler(this);
798 SetActive(false); 799 SetActive(false);
799 } 800 }
800 801
801 802
802 } } // namespace v8::internal 803 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698