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 7973825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:12:51+00:00 2026-06-04T08:12:51+00:00

On development server, I am trying to write data to a single file using

  • 0

On development server, I am trying to write data to a single file using FileService api.
Even if I write small amount of data, closing the file (with close()) doesn’t free memory.
I need to use closeFinally() from FileService to free memory. Therefore my guess is that the entire file is being cached in memory until closeFinally() has been call, which can cause some problems if I want to write a huge file in a single blob.
Is there any way to solve this memory issue ?

Here is the sample code :

String veryLongString = "verryyyyllooooonnnnggggssssttttrrrriiiiinnnnnggggg";
for (int i = 0; i < 10; ++i) {
    veryLongString += veryLongString;
}
// veryLongString.length() => 51200 char

FileService FILESERVICE =
    FileServiceFactory.getFileService();

// Create new file
String newPath =
    FILESERVICE.createNewBlobFile("application/octet-stream").getFullPath();

for (int i = 0; i < 10; ++i) {
    System.out.println(i);

    // Open file for append
    AppEngineFile file = new AppEngineFile(newPath);
    FileWriteChannel writeChannel = FILESERVICE.openWriteChannel(file, true);
    OutputStream out = Channels.newOutputStream(writeChannel);

    // Append some data to this file
    for (int j = 0; j < 5000; ++j) {
        out.write(veryLongString.getBytes());
    }
    writeChannel.close();
    // Writed 5000*51200 => 256Mo char (to memory, should be
    // also persisted to disk)
}

// Writed all data we want, we finally close the file
AppEngineFile file = new AppEngineFile(newPath);
FileWriteChannel writeChannel = FILESERVICE.openWriteChannel(file, true);
writeChannel.closeFinally();

Output :

0
1
2
3
com.google.apphosting.api.ApiProxy$UnknownException: An error occurred for the API request file.Append().
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:518)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:452)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:430)
    at java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:463)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:460)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2786)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
    at java.io.OutputStream.write(OutputStream.java:58)
    at com.google.appengine.api.files.dev.FileMetadata.append(FileMetadata.java:198)
    at com.google.appengine.api.files.dev.LocalFileService.append(LocalFileService.java:357)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:498)
    ... 10 more
  • 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-04T08:12:52+00:00Added an answer on June 4, 2026 at 8:12 am

    The development server is designed to help you test and debug your application; scalability is not a primary concern for it. You’re correct that it caches the file in memory; this is how it’s supposed to work.

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

Sidebar

Related Questions

I am trying the Urban Airship APNS development push server. When I run their
I am trying to set up a development environment for our web server. I
During development, I usually test ASP.Net applications using the Web Development Server (sometimes called
I am trying to test on a private development server, and I can't use
I'm trying to deploy my application to a locally running GoogleAppEngine development server, but
I'm creating an online community and I'm trying to set up a development server.
I trying to publish my app from my own PC to the server "C:\Development\MyApp"
I trying to publish my app from my own PC to the server "C:\Development\MyApp"
I've been trying to use Django-appengine to write a small web app, but I
I am trying to write a stored procedure to assist with development of our

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.