RFR: 8354969: Add strdup function for ResourceArea [v3]

David Holmes dholmes at openjdk.org
Thu May 15 06:59:55 UTC 2025


On Wed, 14 May 2025 07:35:29 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> Added a strdup() method, as requested by the bug reporter. The method is added to Arena, but also available in ResourceArea, as requested. A test for the method is provided. 
>> 
>> Testing: tiers 1-3 on multiple platforms.
>
> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8354969: Added usecases for strdup in resource area

src/hotspot/share/memory/allocation.hpp line 551:

> 549: 
> 550: #define RESOURCE_STRDUP(src)\
> 551:   resource_strdup((char*)src)

Why the `char*` cast when the parameter is expected to be a `const char*`?

src/hotspot/share/memory/allocation.hpp line 554:

> 552: 
> 553: #define RESOURCE_STRDUP_IN_THREAD(thread, src)\
> 554:   resource_strdup(thread, (char*)src)

Why the macros? I expected to see `ResourceObj::strdup` similar to `os::strdup`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24998#discussion_r2090422591
PR Review Comment: https://git.openjdk.org/jdk/pull/24998#discussion_r2090419683


More information about the hotspot-dev mailing list