Skip to content
Permalink
Browse files

8241462: StripNativeDebugSymbols jlink plugin allocates huge arrays

Reviewed-by: alanb, sgehwolf
  • Loading branch information
shipilev committed Mar 24, 2020
1 parent 643f5b5 commit 6694402d3da21e82ddc15cd56e578981ae176bb6
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Red Hat, Inc.
* Copyright (c) 2019, 2020, Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
*/
package jdk.tools.jlink.internal.plugins;

import java.io.InputStream;
import java.io.IOException;
import java.lang.ProcessBuilder.Redirect;
import java.nio.file.FileVisitResult;
@@ -313,7 +314,10 @@ private StrippedDebugInfoBinaryBuilder(boolean includeDebug,
Path resourceFileBinary = tempDir.resolve(relativeFileName);
String relativeDbgFileName = relativeFileName + "." + debugExt;

Files.write(resourceFileBinary, resource.contentBytes());
try (InputStream in = resource.content()) {
Files.copy(in, resourceFileBinary);
}

Path resourceFileDebugSymbols;
if (includeDebug) {
resourceFileDebugSymbols = tempDir.resolve(Paths.get(relativeDbgFileName));

0 comments on commit 6694402

Please sign in to comment.