RFR: 8266187: Memory leak in appendBootClassPath()
Wang Huang
whuang at openjdk.java.net
Thu Apr 29 01:33:58 UTC 2021
On Wed, 28 Apr 2021 12:17:18 GMT, Kevin Walls <kevinw at openjdk.org> wrote:
> Hi,
> I didn't find it immediately obvious that this was safe, but I followed things and think that it is correct:
>
> The malloc'd pointer gets passed to...
> JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
>
> which calls
>
> ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bool is_boot_append) {
>
> ..which calls
>
> char* ClassLoader::get_canonical_path(const char* orig, Thread* thread) {
>
> ...which makes a copy of the string:
> char* orig_copy = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, strlen(orig)+1);
> strcpy(orig_copy, orig);
> ...and doesn't apear to keep the pointer. So yes I think we should free it. 8-)
Thank you for your review and explanation.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3751
More information about the serviceability-dev
mailing list