# \#managedbuffer

**URL:** https://forums.swift.org/tag/managedbuffer/638.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [ManagedBuffer Header vs Elements in AllocatedUnfairLock](https://forums.swift.org/t/managedbuffer-header-vs-elements-in-allocatedunfairlock/74566)

<div class="topic-metadata">

**Author:** [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Replies:** 2\
**Last updated:** [September 13, 2024, 4:31pm UTC](https://forums.swift.org/t/managedbuffer-header-vs-elements-in-allocatedunfairlock/74566 "2024-09-13T16:31:32Z")

</div>

i was looking at some code that @dmt linked to in another thread recently that provides a re-implementation of the OSAllocatedUnfairLock API. the underlying storage uses a ManagedBuffer to hold the State and lock. i foun…

---

## [What are the benefits of ManagedBuffer?](https://forums.swift.org/t/what-are-the-benefits-of-managedbuffer/62544)

<div class="topic-metadata">

**Author:** [@Jesse\_Grosjean](https://forums.swift.org/u/Jesse_Grosjean)\
**Replies:** 2\
**Last updated:** [January 14, 2023, 12:50am UTC](https://forums.swift.org/t/what-are-the-benefits-of-managedbuffer/62544 "2023-01-14T00:50:52Z")

</div>

I have a buffer class that looks like this: class Buffer1 { inner: ContiguousArray\<UInt8\> } For learning and maybe performance I'm testing this against a ManagedBuffer. My understanding is that ManagedBuffer will …

---

## [ManagedBuffer.header and exclusivity](https://forums.swift.org/t/managedbuffer-header-and-exclusivity/55013)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 8\
**Last updated:** [February 4, 2022, 12:29am UTC](https://forums.swift.org/t/managedbuffer-header-and-exclusivity/55013 "2022-02-04T00:29:33Z")

</div>

I've noticed a bit of a performance footgun with ManagedBuffer. The header is written as a class property in the standard library's source code. This means it requires dynamic enforcement of the law of exclusivity, whic…
