# `🌋 vk-mem-alloc-rs` **A very lightweight wrapper around the Vulkan Memory Allocator 🦀** [![license][license-badge]][license-url] [![vma][vma-badge]][vma-url] [![dependency-status][dependency-badge]][dependency-url] [license-badge]: https://img.shields.io/badge/License-MIT/Apache_2.0-blue.svg [license-url]: LICENSE-MIT [vma-badge]: https://img.shields.io/badge/Vulkan%20Memory%20Allocator-3.0.1-orange [vma-url]: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator [dependency-badge]: https://deps.rs/repo/github/projectkml/vk-mem-alloc-rs/status.svg [dependency-url]: https://deps.rs/repo/github/projectkml/vk-mem-alloc-rs

toml [dependencies] vk-mem-alloc = "0.1.0"

Simple Vulkan Memory Allocator example

```Rust // Create the allocator let allocator = vkmemalloc::createallocator(&instance, physicaldevice, &device).unwrap();

let buffercreateinfo = vk::BufferCreateInfo::default() .size(size) .usage(vk::BufferUsageFlags::STORAGE_BUFFER);

let allocationcreateinfo = vkmemalloc::AllocationCreateInfo { usage: vkmemalloc::MemoryUsage::AUTOPREFERDEVICE, ..Default::default() };

// Create the buffer let (buffer, allocation, allocationinfo) = vkmemalloc::createbuffer(allocator, &buffercreateinfo, &allocationcreateinfo).unwrap();

....

// Destroy the buffer vkmemalloc::destroy_buffer(allocator, buffer, allocation);

// Destroy the allocator vkmemalloc::destroy_allocator(allocator); ```

Credits