RFR: 8357915: SecureRandom nextLong memory usage [v2]

Koushik Muthukrishnan Thirupattur duke at openjdk.org
Thu Jul 3 05:38:39 UTC 2025


On Thu, 3 Jul 2025 05:19:42 GMT, Koushik Muthukrishnan Thirupattur <duke at openjdk.org> wrote:

>> The suggestion in the issue was to switch to RandomGenerator.nextLong() can you provide an explanation as to why that is not an acceptable solution.  It would avoid any allocation.  Thanks
>
>> The suggestion in the issue was to switch to RandomGenerator.nextLong() can you provide an explanation as to why that is not an acceptable solution. It would avoid any allocation. Thanks
> 
> As per our offline discussion, I am keeping this change of overriding nextlong() in secure random. Thanks!

> @koushikthirupattur can you please add a regression test to provide coverage for `nextLong`?

Sure, we can add one for coverage but I wanted to learn if we really need a regression test in this case as there is no behavior change to test against and this fix only improves internal memory allocation in `SecureRandom.nextLong()`. Let me know.

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

PR Comment: https://git.openjdk.org/jdk/pull/26005#issuecomment-3030845683


More information about the security-dev mailing list