This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new bc8d75b Fix BZ 65177 reduce memory footprint to avoid OOME on 32-bit
JVMs
bc8d75b is described below
commit bc8d75b488961ef963efef430c30bcbab2ca4564
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Mar 9 14:12:42 2021 +0000
Fix BZ 65177 reduce memory footprint to avoid OOME on 32-bit JVMs
https://bz.apache.org/bugzilla/show_bug.cgi?id=65177
---
test/org/apache/tomcat/util/net/TestSsl.java | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java
b/test/org/apache/tomcat/util/net/TestSsl.java
index 1f70b8f..d7881cf 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -80,6 +80,12 @@ public class TestSsl extends TomcatBaseTest {
}
private static final int POST_DATA_SIZE = 16 * 1024 * 1024;
+ private static final byte[] POST_DATA;
+ static {
+ POST_DATA = new byte[POST_DATA_SIZE]; // 16MB
+ Arrays.fill(POST_DATA, (byte) 1);
+
+ }
@Test
public void testPost() throws Exception {
@@ -107,15 +113,12 @@ public class TestSsl extends TomcatBaseTest {
OutputStream os = socket.getOutputStream();
- byte[] bytes = new byte[POST_DATA_SIZE]; // 16MB
- Arrays.fill(bytes, (byte) 1);
-
os.write("POST /post HTTP/1.1\r\n".getBytes());
os.write("Host: localhost\r\n".getBytes());
- os.write(("Content-Length: " +
Integer.valueOf(bytes.length) + "\r\n\r\n").getBytes());
+ os.write(("Content-Length: " +
Integer.valueOf(POST_DATA.length) + "\r\n\r\n").getBytes());
// Write in 128KB blocks
- for (int i = 0; i < bytes.length / (128 * 1024); i++) {
- os.write(bytes, 0, 1024 * 128);
+ for (int i = 0; i < POST_DATA.length / (128 * 1024);
i++) {
+ os.write(POST_DATA, 0, 1024 * 128);
Thread.sleep(10);
}
os.flush();
@@ -139,11 +142,11 @@ public class TestSsl extends TomcatBaseTest {
}
}
- for (int i = 0; i < bytes.length; i++) {
+ for (int i = 0; i < POST_DATA.length; i++) {
int read = is.read();
- if (bytes[i] != read) {
+ if (POST_DATA[i] != read) {
System.err.println("Byte in position [" + i +
"] had value [" + read +
- "] rather than [" +
Byte.toString(bytes[i]) + "]");
+ "] rather than [" +
Byte.toString(POST_DATA[i]) + "]");
errorCount.incrementAndGet();
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]