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

Side by Side Diff: src/heap.cc

Issue 7020020: Lower heap size limits on systems that are short of virtual memory. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 6 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 | « no previous file | src/platform.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 last_idle_notification_gc_count_init_(false), 145 last_idle_notification_gc_count_init_(false),
146 configured_(false), 146 configured_(false),
147 is_safe_to_read_maps_(true) { 147 is_safe_to_read_maps_(true) {
148 // Allow build-time customization of the max semispace size. Building 148 // Allow build-time customization of the max semispace size. Building
149 // V8 with snapshots and a non-default max semispace size is much 149 // V8 with snapshots and a non-default max semispace size is much
150 // easier if you can define it as part of the build environment. 150 // easier if you can define it as part of the build environment.
151 #if defined(V8_MAX_SEMISPACE_SIZE) 151 #if defined(V8_MAX_SEMISPACE_SIZE)
152 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 152 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
153 #endif 153 #endif
154 154
155 intptr_t max_virtual = OS::MaxVirtualMemory();
156
157 if (max_virtual > 0) {
158 // If we have limits on the amount of virtual memory we can use then we may
159 // be forced to lower the allocation limits. We reserve one quarter of the
160 // memory for young space and off-heap data. The rest is distributed as
161 // described below.
162 if (code_range_size_ > 0) {
Kasper Lund 2011/06/01 08:46:04 Maybe introduce two local variables, half and quar
163 // Reserve a quarter of the memory for the code range. The old space
164 // heap gets the remaining half. There is some unavoidable double
165 // counting going on here since the heap size is measured in committed
166 // virtual memory and the code range is only reserved virtual memory.
167 code_range_size_ = Min(code_range_size_, max_virtual >> 2);
168 max_old_generation_size_ =
169 Min(max_old_generation_size_, max_virtual >> 1);
170 } else {
171 // Reserve three quarters of the memory for the old space heap including
172 // the executable code.
173 max_old_generation_size_ = Min(max_old_generation_size_,
174 (max_virtual >> 2) + (max_virtual >> 1));
175 }
176 }
177
155 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); 178 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
156 global_contexts_list_ = NULL; 179 global_contexts_list_ = NULL;
157 mark_compact_collector_.heap_ = this; 180 mark_compact_collector_.heap_ = this;
158 external_string_table_.heap_ = this; 181 external_string_table_.heap_ = this;
159 } 182 }
160 183
161 184
162 intptr_t Heap::Capacity() { 185 intptr_t Heap::Capacity() {
163 if (!HasBeenSetup()) return 0; 186 if (!HasBeenSetup()) return 0;
164 187
(...skipping 5758 matching lines...) Expand 10 before | Expand all | Expand 10 after
5923 } 5946 }
5924 5947
5925 5948
5926 void ExternalStringTable::TearDown() { 5949 void ExternalStringTable::TearDown() {
5927 new_space_strings_.Free(); 5950 new_space_strings_.Free();
5928 old_space_strings_.Free(); 5951 old_space_strings_.Free();
5929 } 5952 }
5930 5953
5931 5954
5932 } } // namespace v8::internal 5955 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698