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

  • Home
  • SEARCH
  • 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 254765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:52:27+00:00 2026-05-11T21:52:27+00:00

Essentially, I have a very large List containing in turn relatively large Dictionaries. So

  • 0

Essentially, I have a very large List containing in turn relatively large Dictionaries.

So basically, I have a very big in memory collection.

I then serialize this collection manually to XML, and send it over http. needless to say, the XML is too large, sometimes so large I get an OutOfMemory exception before even trying to send it.

In .NET, how would I go about calculating potential memory usage. For example, in this case, I have to break down the XML into chunks, by processing only small amounts of the Collection at a time.

How do I efficiently calculate the size of each "chunk" on-the-fly. I don’t want to pick an arbitrary number like, "process 100 items at any one time", I want to know, approximately, how big each chunk should be for a case by case basis.

cheers

UPDATE

Although @Jacob provided the best solution for this particular problem, the conceptual structure of the app is itself flawed.

Indeed, the solution is to execute a fraction of your message, in order to calculate how potentially big the message will be, when working with a collection.

You then send each acceptably sized unit, one by one.

But this is only a hack. The real solution is to either find a way to not pass large messages, or use a completely different protocol altogether.

There’s an interesting post on the subject here though if you want to use SOAP, however I decided to find a way around sending so much data.

  • 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-11T21:52:28+00:00Added an answer on May 11, 2026 at 9:52 pm

    I think you might have a conceptual problem more than anything else. “Calculate potential memory usage” is at odds with “efficiently calculate the size of each chunk”. The only way to really get at your memory usage to the degree of accuracy where you can predict adequate chunk size is to actually make your conversion.

    It sounds like the best way to come at this efficiently might be to tackle it progressively–essentially what those who are suggesting streaming objects are saying. If you can’t leverage actual streaming, you’ll probably want to structure your serialization so that you progress one conceptual unit at a time (i.e. one item in your list with it’s attendant dictionary children).

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

Sidebar

Related Questions

I have some very large (>4 GB) files containing (millions of) fixed-length binary records.
I have a very large, spread out class that is essentially a very contrived
The task I have is to (somewhat efficiently) read line-by-line through a very large,
Have a very large program where there is always a superview that just encompasses
Currently I have started on very large Legacy Project and am in a situation
I have a site that's growing large, and has very separate needs for different
I have a very very large array of 44,000+ objects in a javascript file.
I am working on a (very, very large) set of static webpages that essentially
Essentially I have a method of a class called killProgram, which is intended to
Essentially I have an NSMutableArray which contains several NSDictionaries . I wish to sort

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.