Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:47:35+00:00 2026-06-10T21:47:35+00:00

So getting this error when trying to render a page on using Velocity via

  • 0

So getting this error when trying to render a page on using Velocity via Turbine servlet. The thing is I have tons of memory, and the servlet itself never crashes. It just fails on this request. The page it’s trying to render is maybe 10M.

Anyone have any thoughts/suggestions?

 java.lang.OutOfMemoryError: Java heap space
 java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2271) at
 java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113) at
 java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
 at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
 at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at
 sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) at
 sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at
 sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135) at
 java.io.OutputStreamWriter.write(OutputStreamWriter.java:220) at
 java.io.Writer.write(Writer.java:157) at
 org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:321)
 at
 org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
 at
 org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:109)
 at
 org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
 at
 org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271)
 at
 org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:128)
 at
 org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
 at
 org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271)
 at
 org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:128)
 at
 org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271)
 at org.apache.velocity.Template.merge(Template.java:296) at
 org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:492) at
 org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:461) at
 org.apache.turbine.services.velocity.TurbineVelocityService.executeRequest(TurbineVelocityService.java:455)
 at
 org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(TurbineVelocityService.java:321)
 at
 org.apache.turbine.services.velocity.TurbineVelocity.handleRequest(TurbineVelocity.java:109)
 at
 org.apache.turbine.modules.layouts.VelocityOnlyLayout.doBuild(VelocityOnlyLayout.java:155)
 at org.apache.turbine.modules.Layout.build(Layout.java:91) at
 org.apache.turbine.modules.LayoutLoader.exec(LayoutLoader.java:138) at
 org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:191)
 at org.apache.turbine.modules.Page.build(Page.java:91) at
 org.apache.turbine.modules.PageLoader.exec(PageLoader.java:136)

JAVA_OPTS= -Xms4096M -Xmn2048M -Xmx13128M

Memory usage under top never gets above 100M.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:47:37+00:00Added an answer on June 10, 2026 at 9:47 pm

    I suspect that your -Xmn is causing the problem, by reserving too large a chunk of the initial heap for the young generation. I would suggesting running your server without this, and seeing what happens.

    My reasoning for this is that the failure occurs on ByteArrayOutputStream.grow(), which is creating a new array that is some percentage larger than the existing one. Large arrays (> 512M) get put directly into the tenured generation, so if too much space is reserved for the young generation, there may not be enough available in tenured.

    Another possibility is that your rendered template is far larger than you think it is. Although the most likely cause for this is a loop, and I don’t see that in the stack trace.

    Finally, add the -XX:+HeapDumpOnOutOfMemoryError option when starting. If your output arrays are growing too large, you’ll see this in the heap dump (use jhat to examine the dump).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following error when trying to produce an HTML page using Jade.
I am new to php and I am getting this error trying to load
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I'm getting this error when trying to access my webservice running inside tomcat. Caused
I am getting this error when trying to merge TFS2008. There are no pending
I keep getting this error while trying to modify some tables. Here's my code:
I'm new to AS3 and I'm getting this error while trying to implement OO
A buddy of mine has been getting this error mesage when trying to run
Keep getting this error after inserting a subdatasheet into a query and trying to
I'm getting this strange error message when trying to clone or pull from git.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.