namespace collector { class MarkSweep;
} // namespace collector
namespace space {
// An alloc space is a space where objects may be allocated and garbage collected. Not final as may // be overridden by a MemoryToolMallocSpace. class DlMallocSpace : public MallocSpace { public: // Create a DlMallocSpace from an existing mem_map. static DlMallocSpace* CreateFromMemMap(MemMap&& mem_map, const std::string& name,
size_t starting_size,
size_t initial_size,
size_t growth_limit,
size_t capacity, bool can_move_objects);
// Create a DlMallocSpace with the requested sizes. The requested // base address is not guaranteed to be granted, if it is required, // the caller should call Begin on the returned space to confirm the // request was granted. static DlMallocSpace* Create(const std::string& name,
size_t initial_size,
size_t growth_limit,
size_t capacity, bool can_move_objects);
// Virtual to allow MemoryToolMallocSpace to intercept.
mirror::Object* AllocWithGrowth(Thread* self,
size_t num_bytes,
size_t* bytes_allocated,
size_t* usable_size,
size_t* bytes_tl_bulk_allocated) override REQUIRES(!lock_); // Virtual to allow MemoryToolMallocSpace to intercept.
mirror::Object* Alloc(Thread* self,
size_t num_bytes,
size_t* bytes_allocated,
size_t* usable_size,
size_t* bytes_tl_bulk_allocated) override REQUIRES(!lock_) { return AllocNonvirtual(self, num_bytes, bytes_allocated, usable_size,
bytes_tl_bulk_allocated);
} // Virtual to allow MemoryToolMallocSpace to intercept.
size_t AllocationSize(mirror::Object* obj, size_t* usable_size) override { return AllocationSizeNonvirtual(obj, usable_size);
} // Virtual to allow MemoryToolMallocSpace to intercept.
size_t Free(Thread* self, mirror::Object* ptr) override
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_); // Virtual to allow MemoryToolMallocSpace to intercept.
size_t FreeList(Thread* self, size_t num_ptrs, mirror::Object** ptrs) override
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
#ifndef NDEBUG // Override only in the debug build. void CheckMoreCoreForPrecondition() override; #endif
void* GetMspace() const { return mspace_;
}
size_t Trim() override;
// Perform a mspace_inspect_all which calls back for each allocation chunk. The chunk may not be // in use, indicated by num_bytes equaling zero. void Walk(WalkCallback callback, void* arg) override REQUIRES(!lock_);
// Returns the number of bytes that the space has currently obtained from the system. This is // greater or equal to the amount of live data in the space.
size_t GetFootprint() override;
// Returns the number of bytes that the heap is allowed to obtain from the system via MoreCore.
size_t GetFootprintLimit() override;
// Set the maximum number of bytes that the heap is allowed to obtain from the system via // MoreCore. Note this is used to stop the mspace growing beyond the limit to Capacity. When // allocations fail we GC before increasing the footprint limit and allowing the mspace to grow. void SetFootprintLimit(size_t limit) override;
// The boundary tag overhead. staticconst size_t kChunkOverhead = sizeof(intptr_t);
// Underlying malloc space. void* mspace_;
friendclass collector::MarkSweep;
DISALLOW_COPY_AND_ASSIGN(DlMallocSpace);
};
} // namespace space
namespace allocator {
// Callback from dlmalloc when it needs to increase the footprint. // Must be implemented outside of art-dlmalloc.cc. void* ArtDlMallocMoreCore(void* mspace, intptr_t increment);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.