On Wed, 12 Nov 2025 11:19:51 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

> Then, we have three cases:
> 
>     * if the requested alignment `A` is `A <= MIN_ALIGN`, we can just 
> allocate and don't adjust for alignment
> 
>     * if the requested alignment `A` is `MIN_ALIGN < A <= MAX_ALIGN` and the 
> requested size is a multiple of the alignment, also just allocate and don't 
> adjust for alignment
> 
>     * otherwise, allocate a bigger segment and manually align the result

If we can't establish a min alignment, we could at least have some way to 
determine the max alignment (I'd say probably 16 is a good number because of 
system ABI?), and then just use two rules:

 * if the requested alignment `A` is `A <= MAX_ALIGN` **and** the requested 
size is a multiple of the alignment, also just allocate and don't adjust for 
alignment
 * otherwise, allocate a bigger segment and manually align the result
 
 This should still deliver the kind of compaction we were aiming for with the 
optimization, but hopefully get there in a more portable way?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28235#issuecomment-3521457435

Reply via email to