Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Philipp Klaus Krause <pkk@spth.de> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Cheap malloc() |
| Date | 2015-10-07 14:48 +0200 |
| Organization | solani.org |
| Message-ID | <mv34a8$a0v$1@solani.org> (permalink) |
| References | <mutp9b$1s8$1@solani.org> <mv0fom$s6$1@dont-email.me> |
On 06.10.2015 14:47, Bartc wrote: > On 05/10/2015 13:09, Philipp Klaus Krause wrote: > >> But I didn't find something on >> making memory management cheaper in terms of overhead. >> >> So I came up with the following idea, which seems quite natural to me, >> but I haven't seen it anywhere else. It only stores a single pointer per >> allocated block, and has thus quite low overhead. > >> It uses a linked list of blocks. Each block is either allocated or free. >> The list of free blocks comes and no memory cost, since it is stored in >> free blocks only > > How does it know the size of each block? Or is each block always linked > to the next sequential one? Yes. Each one is linked to the next one. That is the one pointer stored in every block, and the only overhead. > >> Are there other malloc() implementations with such low overhead around? > >> P.S.: The malloc() is intended to replace the current one in SDCC, and >> thus is intended to work well for SDCC's target architectures - 8-bit >> with no alignment restrictions, typically 128B to 64KB of RAM; the XDATA >> is defined as a named address space for sometarget architectures (8051 >> and related). > > If this is to replace a normal malloc() and thus have to support > conventional malloc/free calls of someone else's code, then your hands > are tied somewhat. > > […] > It is supposed to replace the memory management that SDCC currently provides. Philipp
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Cheap malloc() Philipp Klaus Krause <pkk@spth.de> - 2015-10-05 14:09 +0200
Re: Cheap malloc() Robert Wessel <robertwessel2@yahoo.com> - 2015-10-05 09:52 -0500
Re: Cheap malloc() Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-05 11:04 -0400
Re: Cheap malloc() BGB <cr88192@hotmail.com> - 2015-10-05 20:36 -0500
Re: Cheap malloc() Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-06 07:54 -0400
Re: Cheap malloc() BGB <cr88192@hotmail.com> - 2015-10-06 08:06 -0500
Re: Cheap malloc() Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-07 07:46 -0400
Re: Cheap malloc() BGB <cr88192@hotmail.com> - 2015-10-07 07:35 -0500
Re: Cheap malloc() glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-06 23:29 +0000
Re: Cheap malloc() supercat@casperkitty.com - 2015-10-05 08:12 -0700
Re: Cheap malloc() glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-05 16:34 +0000
Re: Cheap malloc() Philipp Klaus Krause <pkk@spth.de> - 2015-10-07 14:50 +0200
Re: Cheap malloc() BGB <cr88192@hotmail.com> - 2015-10-07 08:45 -0500
Re: Cheap malloc() Philipp Klaus Krause <pkk@spth.de> - 2015-10-07 19:33 +0200
Re: Cheap malloc() BGB <cr88192@hotmail.com> - 2015-10-07 15:40 -0500
Re: Cheap malloc() glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-08 01:10 +0000
Re: Cheap malloc() Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-08 08:08 -0400
Re: Cheap malloc() Bartc <bc@freeuk.com> - 2015-10-06 13:47 +0100
Re: Cheap malloc() Philipp Klaus Krause <pkk@spth.de> - 2015-10-07 14:48 +0200
csiph-web