malloc_space.h revision d7576328811e5103e99d31f834a857522cc1463f
1cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi/* 2cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * Copyright (C) 2013 The Android Open Source Project 3cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * 4cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * Licensed under the Apache License, Version 2.0 (the "License"); 5cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * you may not use this file except in compliance with the License. 6cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * You may obtain a copy of the License at 7cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * 8cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * http://www.apache.org/licenses/LICENSE-2.0 9cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * 10cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * Unless required by applicable law or agreed to in writing, software 11cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * distributed under the License is distributed on an "AS IS" BASIS, 12cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * See the License for the specific language governing permissions and 14cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi * limitations under the License. 15cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi */ 16cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 17cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#ifndef ART_RUNTIME_GC_SPACE_MALLOC_SPACE_H_ 18cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#define ART_RUNTIME_GC_SPACE_MALLOC_SPACE_H_ 19cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 20cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#include "space.h" 21cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 22cf7f19135f0e273f7b0136315633c2abfc715343Ian Rogers#include <ostream> 237cb7bbcfffb2716ef8d68ecb747954ec42c4bdc5Hiroshi Yamauchi#include <valgrind.h> 247cb7bbcfffb2716ef8d68ecb747954ec42c4bdc5Hiroshi Yamauchi#include <memcheck/memcheck.h> 257cb7bbcfffb2716ef8d68ecb747954ec42c4bdc5Hiroshi Yamauchi 26cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchinamespace art { 27cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchinamespace gc { 28cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 29cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchinamespace collector { 30cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi class MarkSweep; 31cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi} // namespace collector 32cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 33cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchinamespace space { 34cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 35a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartierclass ZygoteSpace; 36a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier 37cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi// TODO: Remove define macro 38cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#define CHECK_MEMORY_CALL(call, args, what) \ 39cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi do { \ 40cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi int rc = call args; \ 41cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi if (UNLIKELY(rc != 0)) { \ 42cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi errno = rc; \ 43cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi PLOG(FATAL) << # call << " failed for " << what; \ 44cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } \ 45cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } while (false) 46cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 47cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi// A common parent of DlMallocSpace and RosAllocSpace. 48cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchiclass MallocSpace : public ContinuousMemMapAllocSpace { 49cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi public: 50cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi typedef void(*WalkCallback)(void *start, void *end, size_t num_bytes, void* callback_arg); 51cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 52cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi SpaceType GetType() const { 53a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier return kSpaceTypeMallocSpace; 54cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } 55cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 56cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Allocate num_bytes allowing the underlying space to grow. 576fac447555dc94a935b78198479cce645c837b89Ian Rogers virtual mirror::Object* AllocWithGrowth(Thread* self, size_t num_bytes, 586fac447555dc94a935b78198479cce645c837b89Ian Rogers size_t* bytes_allocated, size_t* usable_size) = 0; 596fac447555dc94a935b78198479cce645c837b89Ian Rogers // Allocate num_bytes without allowing the underlying space to grow. 606fac447555dc94a935b78198479cce645c837b89Ian Rogers virtual mirror::Object* Alloc(Thread* self, size_t num_bytes, size_t* bytes_allocated, 616fac447555dc94a935b78198479cce645c837b89Ian Rogers size_t* usable_size) = 0; 626fac447555dc94a935b78198479cce645c837b89Ian Rogers // Return the storage space required by obj. If usable_size isn't nullptr then it is set to the 636fac447555dc94a935b78198479cce645c837b89Ian Rogers // amount of the storage space that may be used by obj. 646fac447555dc94a935b78198479cce645c837b89Ian Rogers virtual size_t AllocationSize(mirror::Object* obj, size_t* usable_size) = 0; 65ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers virtual size_t Free(Thread* self, mirror::Object* ptr) 66ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; 67ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers virtual size_t FreeList(Thread* self, size_t num_ptrs, mirror::Object** ptrs) 68ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; 69cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 70cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#ifndef NDEBUG 71cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual void CheckMoreCoreForPrecondition() {} // to be overridden in the debug build. 72cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#else 73cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi void CheckMoreCoreForPrecondition() {} // no-op in the non-debug build. 74cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi#endif 75cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 76cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi void* MoreCore(intptr_t increment); 77cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 78cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Hands unused pages back to the system. 79cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual size_t Trim() = 0; 80cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 81cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Perform a mspace_inspect_all which calls back for each allocation chunk. The chunk may not be 82cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // in use, indicated by num_bytes equaling zero. 83cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual void Walk(WalkCallback callback, void* arg) = 0; 84cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 85cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Returns the number of bytes that the space has currently obtained from the system. This is 86cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // greater or equal to the amount of live data in the space. 87cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual size_t GetFootprint() = 0; 88cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 89cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Returns the number of bytes that the heap is allowed to obtain from the system via MoreCore. 90cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual size_t GetFootprintLimit() = 0; 91cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 92cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Set the maximum number of bytes that the heap is allowed to obtain from the system via 93cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // MoreCore. Note this is used to stop the mspace growing beyond the limit to Capacity. When 94cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // allocations fail we GC before increasing the footprint limit and allowing the mspace to grow. 95cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual void SetFootprintLimit(size_t limit) = 0; 96cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 97cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Removes the fork time growth limit on capacity, allowing the application to allocate up to the 98cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // maximum reserved size of the heap. 99cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi void ClearGrowthLimit() { 100cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi growth_limit_ = NonGrowthLimitCapacity(); 101cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } 102cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 103cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Override capacity so that we only return the possibly limited capacity 104cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi size_t Capacity() const { 105cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi return growth_limit_; 106cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } 107cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 108cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // The total amount of memory reserved for the alloc space. 109cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi size_t NonGrowthLimitCapacity() const { 110cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi return GetMemMap()->Size(); 111cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi } 112cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 113cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi void Dump(std::ostream& os) const; 114cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 115cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi void SetGrowthLimit(size_t growth_limit); 116cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 117d7576328811e5103e99d31f834a857522cc1463fAndreas Gampe virtual MallocSpace* CreateInstance(MemMap* mem_map, const std::string& name, void* allocator, 118d7576328811e5103e99d31f834a857522cc1463fAndreas Gampe uint8_t* begin, uint8_t* end, uint8_t* limit, 119d7576328811e5103e99d31f834a857522cc1463fAndreas Gampe size_t growth_limit, bool can_move_objects) = 0; 120cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 121a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier // Splits ourself into a zygote space and new malloc space which has our unused memory. When true, 122a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier // the low memory mode argument specifies that the heap wishes the created space to be more 123a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier // aggressive in releasing unused pages. Invalidates the space its called on. 124a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier ZygoteSpace* CreateZygoteSpace(const char* alloc_space_name, bool low_memory_mode, 125a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier MallocSpace** out_malloc_space) NO_THREAD_SAFETY_ANALYSIS; 126cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual uint64_t GetBytesAllocated() = 0; 127cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi virtual uint64_t GetObjectsAllocated() = 0; 128cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 129cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Returns the class of a recently freed object. 130cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi mirror::Class* FindRecentFreedObject(const mirror::Object* obj); 131cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 13231f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier bool CanMoveObjects() const OVERRIDE { 13331f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier return can_move_objects_; 13431f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier } 13531f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier 1366a7824dc81aaab3cb09ced16affca72d1b1da649Mathieu Chartier void DisableMovingObjects() { 1376a7824dc81aaab3cb09ced16affca72d1b1da649Mathieu Chartier can_move_objects_ = false; 1386a7824dc81aaab3cb09ced16affca72d1b1da649Mathieu Chartier } 1396a7824dc81aaab3cb09ced16affca72d1b1da649Mathieu Chartier 140cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi protected: 14113735955f39b3b304c37d2b2840663c131262c18Ian Rogers MallocSpace(const std::string& name, MemMap* mem_map, uint8_t* begin, uint8_t* end, 14213735955f39b3b304c37d2b2840663c131262c18Ian Rogers uint8_t* limit, size_t growth_limit, bool create_bitmaps, bool can_move_objects, 14331f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier size_t starting_size, size_t initial_size); 144cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 145cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi static MemMap* CreateMemMap(const std::string& name, size_t starting_size, size_t* initial_size, 14613735955f39b3b304c37d2b2840663c131262c18Ian Rogers size_t* growth_limit, size_t* capacity, uint8_t* requested_begin); 147cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 1486fac447555dc94a935b78198479cce645c837b89Ian Rogers // When true the low memory mode argument specifies that the heap wishes the created allocator to 1496fac447555dc94a935b78198479cce645c837b89Ian Rogers // be more aggressive in releasing unused pages. 150573f7d2d68e1838a0485e6b40d90c967526e00c2Hiroshi Yamauchi virtual void* CreateAllocator(void* base, size_t morecore_start, size_t initial_size, 15126d69ffc0ebc98fbc5f316d8cd3ee6ba5b2001acHiroshi Yamauchi size_t maximum_size, bool low_memory_mode) = 0; 152cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 153661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8Mathieu Chartier virtual void RegisterRecentFree(mirror::Object* ptr) 154ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) 155ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers EXCLUSIVE_LOCKS_REQUIRED(lock_); 156cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 157a8e8f9c0a8e259a807d7b99a148d14104c24209dMathieu Chartier virtual accounting::ContinuousSpaceBitmap::SweepCallback* GetSweepCallback() { 158a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier return &SweepCallback; 159a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier } 160cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 161cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Recent allocation buffer. 162cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi static constexpr size_t kRecentFreeCount = kDebugSpaces ? (1 << 16) : 0; 163cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi static constexpr size_t kRecentFreeMask = kRecentFreeCount - 1; 164cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi std::pair<const mirror::Object*, mirror::Class*> recent_freed_objects_[kRecentFreeCount]; 165cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi size_t recent_free_pos_; 166cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 167cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi static size_t bitmap_index_; 168cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 169cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Used to ensure mutual exclusion when the allocation spaces data structures are being modified. 170cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 171cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 172cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // The capacity of the alloc space until such time that ClearGrowthLimit is called. 173cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // The underlying mem_map_ controls the maximum size we allow the heap to grow to. The growth 174cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // limit is a value <= to the mem_map_ capacity used for ergonomic reasons because of the zygote. 175cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // Prior to forking the zygote the heap will have a maximally sized mem_map_ but the growth_limit_ 176cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // will be set to a lower value. The growth_limit_ is used as the capacity of the alloc_space_, 177cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // however, capacity normally can't vary. In the case of the growth_limit_ it can be cleared 178cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi // one time by a call to ClearGrowthLimit. 179cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi size_t growth_limit_; 180cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 18131f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier // True if objects in the space are movable. 1826a7824dc81aaab3cb09ced16affca72d1b1da649Mathieu Chartier bool can_move_objects_; 18331f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier 18431f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier // Starting and initial sized, used when you reset the space. 18531f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier const size_t starting_size_; 18631f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier const size_t initial_size_; 18731f441464c0c8f840aba37e236ad133f30308d70Mathieu Chartier 188e5eedcb4a634246d1f912992853441f715d705ccHiroshi Yamauchi private: 189ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers static void SweepCallback(size_t num_ptrs, mirror::Object** ptrs, void* arg) 190ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 191a1602f28c0e3127ad511712d4b08db89737ae901Mathieu Chartier 192cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi DISALLOW_COPY_AND_ASSIGN(MallocSpace); 193cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi}; 194cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 195cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi} // namespace space 196cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi} // namespace gc 197cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi} // namespace art 198cf58d4adf461eb9b8e84baa8019054c88cd8acc6Hiroshi Yamauchi 199e5eedcb4a634246d1f912992853441f715d705ccHiroshi Yamauchi#endif // ART_RUNTIME_GC_SPACE_MALLOC_SPACE_H_ 200