Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bo Persson Newsgroups: comp.lang.c++ Subject: Re: Examples of current platforms/architectures where sizeof(void*) > sizeof(int*) ? Date: Wed, 1 Sep 2021 12:48:44 +0200 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net pZ8pjn5I4jJHIyTWEF4A2wuehL/jkIxCs9MLKOA/q2vehFWv8K Cancel-Lock: sha1:PDHtcEaOxGUxXSXFXhdEgvjHGwM= User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Language: sv Xref: csiph.com comp.lang.c++:80964 On 2021-09-01 at 12:17, Bonita Montero wrote: > Am 01.09.2021 um 11:17 schrieb Bo Persson: >> On 2021-09-01 at 11:05, Bonita Montero wrote: >>> Am 01.09.2021 um 10:44 schrieb Bo Persson: >>>> On 2021-09-01 at 10:13, Bonita Montero wrote: >>>>> Am 01.09.2021 um 09:57 schrieb Bo Persson: >>>>> >>>>>> Even on current byte addressed machines, malloc(1) gets us 8- or >>>>>> 16-bytes aligned allocations, partly to reduce memory fragmentation. >>>>> >>>>> No, just to limit the number of size-pools. >>>> >>>> And why do they have memory pools?  :-) >>> >>> To prevent that they would otherwise allocate larger blocks directly >>> from the kernel, which is slower. >>> >> >> So it's not that limiting allocations to just some sizes reduces >> memory fragmentation? > > The discussion is about if there's fragmentation among different > allocations, i.e. external fragmentation, with modern alllocations. > Most allocations are small sized allocations, and with modern allo- > cators theres no external fragmentation at all for this size class > since the allocations are rounded up to 2^N (f.e. with mimalloc up > to 8kB) and looked up in a pool which is also 2^N - the result is > no fragementation among the allocations. > Or, like someone said earlier: Even on current byte addressed machines, malloc(1) gets us 8- or 16-bytes aligned allocations, partly to reduce memory fragmentation.