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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:18:47+00:00 2026-05-12T21:18:47+00:00

I am transferring messages to mobile devices via a web service. The data is

  • 0

I am transferring messages to mobile devices via a web service. The data is an xml string, which I compress using GZipStream, then encode using Base64.
I am getting out-of memory exceptions in the emulator and looking to optimise the process so I have stopped passing the string around by value and removed unecessary copies of byte arrays.
Now I’m wondering about the Base64 encoding. It increases the size of the message, the processing and the memory requirements. Is it strictly necessary?

Edit: Here is how I decompress:

public static byte[] ConvertMessageStringToByteArray(ref string isXml)
{
  return fDecompress(Convert.FromBase64String(isXml));
}

public static byte[] fDecompress(byte[] ivBytes)
{
  const int INT_BufferSize = 2048;

  using (MemoryStream lvMSIn = new MemoryStream(ivBytes))
  using (GZipInputStream lvZipStream = new GZipInputStream(lvMSIn, ivBytes.Length))
  using (MemoryStream lvMSOut = new MemoryStream())
  {
    byte[] lvBuffer = new byte[INT_BufferSize];
    int liSize;
    while (true)
    {
      liSize = lvZipStream.Read(lvBuffer, 0, INT_BufferSize);
      if (liSize <= 0)
        break;

      lvMSOut.Write(lvBuffer, 0, liSize);
    }

    return lvMSOut.ToArray();
  }
}
  • 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-05-12T21:18:47+00:00Added an answer on May 12, 2026 at 9:18 pm

    gzip (which is inside the GZipStream) produces binary data – they won’t fit into a 7-bit text message (SOAP is a text message) unless you do somethning like base64 encoding on them.

    Perhaps the solution is to not gzip/encode (decode/ungzip) a whole buffer, but use streams for that – connect a gzipping stream to an encoding stream and read the result from the output of the latter (or connect the decoding stream to the ungzipping stream). This way you have a chance to consume less memory.

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

Sidebar

Related Questions

For transferring some data from to excel via php I am using this function
I have been using the Bluetooth chat example for transferring data over Bluetooth from
We've been asked to start developing a standardised approach to transferring XML data in
I am needing to log some xml data (which is currently a JDOM Document),
I am transferring different xml files via ftp and it's working fine. But one
I have a question about transferring data through Intent() to a MapView. String coorx
I create an asp.net 4.0 web application which has a web service for uploading
I am transferring a C# asp.net asmx web service to windows 2008 and iis7
Is it possible to automatically encrypt files via 'git push' before transferring to a
As far as I understand the serial port so far, transferring data is done

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.