Coder Social home page Coder Social logo

vkmm_java's Introduction

Vulkan Memory Managers (Java)

Implementation of multiple types of Memory Allocators and a generic MemoryManager.

Buddy Block Allocator

Implements Buddy Memory Allocation. Works by recursively subdividing into two blocks of at least MIN_SUBDIV_SIZE. Each block has a buddy block. When A block and its buddy are freed, the parent is also considered freed.

Linear Memory Allocator

Allocates memory sequentially. Allocations from this memory allocator cannot be freed. Instead, the entire Memory Allocator can be reset, which effectively frees all allocations. Clearing the Linear Memory Allocator does not notify allocations that they are now undefined.

Slab Memory Allocator

Pre-subdivides memory allocations into n-bins. Allocation works by selecting from the best-fit bin and marking that memory as used. This allocator is ideal for a small memory pool.

Stack Memory Allocator

Allocates memory by growing downwards. Supports push and pop. Push remembers the current frame index, while pop resets the frame to the previous frame index. A pop effectively frees all memory allocated within a stack frame.

Unique Memory Allocator

Allocates memory as unique calls to VkAllocateMemory. This is not ideal, since Vulkan limits the number of active Memory Allocations to as low as ~1000 (dependent on hardware). This memory allocator is best used for small demos, large memory allocations, or allocations that persist through the entire lifespan of the application.

MemoryManager

Implements multiple Memory Allocators and selects from them depending on heuristics configured at startup.

Default settings result in:

  • Use UniqueMemoryAllocator when allocation is above 128MB
  • Use BuddyBlockAllocator(s) when between 32KB and 128MB
  • Use SlabAllocator(s) when less than or equal to 32KB.

Default SlabAllocator Slab Sizes:

  • 256x 4KB allocations
  • 128x 8KB allocations
  • 64x 16KB allocations
  • 32x 32KB allocations

Additional BuddyBlockAllocators and SlabAllocators will be constructed if all available allocators are full (for the given range).

vkmm_java's People

Contributors

zmichaels11 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.