Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1001033c authored by Lajos Molnar's avatar Lajos Molnar
Browse files

MemoryDealer: expose internal allocation alignment

Bug: 27722308
Change-Id: Ie4ee1f54edcb711d39f8419a160af1495af0152e
parent ec3c05b2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ public:
    virtual void        deallocate(size_t offset);
    virtual void        dump(const char* what) const;

    // allocations are aligned to some value. return that value so clients can account for it.
    static size_t      getAllocationAlignment();

    sp<IMemoryHeap> getMemoryHeap() const { return heap(); }

protected:
+8 −0
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ public:
    void        dump(const char* what) const;
    void        dump(String8& res, const char* what) const;

    static size_t getAllocationAlignment() { return kMemoryAlign; }

private:

    struct chunk_t {
@@ -264,6 +266,12 @@ SimpleBestFitAllocator* MemoryDealer::allocator() const {
    return mAllocator;
}

// static
size_t MemoryDealer::getAllocationAlignment()
{
    return SimpleBestFitAllocator::getAllocationAlignment();
}

// ----------------------------------------------------------------------------

// align all the memory blocks on a cache-line boundary