From: Christopher Friedt <chrisfriedt@gmail.com>
To: musl@lists.openwall.com
Subject: Re: malloc implementation survey: omalloc
Date: Mon, 30 Jul 2018 15:14:14 -0400 [thread overview]
Message-ID: <CAF4BF-SWa80WdO7y_BNuze6wS-xfthTM7YG7EkW-BgPT09Xh+Q@mail.gmail.com> (raw)
In-Reply-To: <CAF4BF-QqxqZU8-mv+jbf0a-5Wckw1ekk7TK3kpNZRRGeHbEzmA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
On Mon, Jul 30, 2018, 11:09 AM Christopher Friedt, <chrisfriedt@gmail.com>
wrote:
> otential for fragmentation. Otherwise though, the meta-information is
> intrinsic within the pointer, which obliviates the need for external
> storage.
>
I should clarify.
The meta-info in my buddy allocator is only intrinsic if the size of ram,
and offset are constant. Additionally, there is a bitmap of constant size
in .data[1].
Of course, in userspace, there would need to be 1 void*, 1 size_t, and a
bitmap per PoT chunk of memory to manage.
For a 4096-byte page, on a 32-bit system, that would be 4 + 4 + 256 = 304
bytes of overhead.
C
[1]
The size of the bitmap (in bits) is given directly by the geometric series:
F(n) = sum(k, n-1) r^k = (1-r^n)/(1-r)
r is 2.
If 2^U is the memory size, and 2^L is the smallest granularity of
allocation, then n = U - L + 1, and the number of bits in the bitmap is F(
n ).
E.g. 64 bytes of memory, min 8-byte allocation, then F( 4 ) = 15 bits (2
bytes) are needed for the bitmap.
[-- Attachment #2: Type: text/html, Size: 1928 bytes --]
next prev parent reply other threads:[~2018-07-30 19:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 19:26 Markus Wichmann
2018-07-30 15:09 ` Christopher Friedt
2018-07-30 19:14 ` Christopher Friedt [this message]
2018-07-30 19:22 ` Christopher Friedt
2018-07-30 19:34 ` Christopher Friedt
2018-07-31 7:49 ` Markus Wichmann
2018-07-31 14:25 ` Rich Felker
2018-07-31 14:49 ` Christopher Friedt
2018-07-31 0:47 ` Rich Felker
2018-07-31 1:44 ` Rich Felker
2018-08-30 18:16 ` A. Wilcox
2018-08-30 18:46 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAF4BF-SWa80WdO7y_BNuze6wS-xfthTM7YG7EkW-BgPT09Xh+Q@mail.gmail.com \
--to=chrisfriedt@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).