RFR: 8357915: SecureRandom nextLong memory usage [v2]
Bradford Wetmore
wetmore at openjdk.org
Thu Jul 3 21:05:40 UTC 2025
On Mon, 30 Jun 2025 17:45:23 GMT, Koushik Muthukrishnan Thirupattur <duke at openjdk.org> wrote:
>> SecureRandom uses straightforward implementations inherited from Random but in the process does double the memory allocations necessary.
>> The delegation to SecureRandom.engineNextBytes does not provide `int` or `long` values, the caller must allocate a byte array and assemble the value itself.
>> So added an implementation in SecureRandom that call nextBytes(8 bytes) and then convert that to a long.
>
> Koushik Muthukrishnan Thirupattur has updated the pull request incrementally with one additional commit since the last revision:
>
> 8357915: SecureRandom nextLong memory usage
`SecureRandom.nextDouble()` does the same thing, are you (or the submitter) worried about that?
Otherwise looks ok.
-------------
Marked as reviewed by wetmore (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26005#pullrequestreview-2984527845
More information about the security-dev
mailing list