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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:25:44+00:00 2026-05-26T00:25:44+00:00

Background: I have a 2 class A & B. Class A contains 1 int64,

  • 0

Background:
I have a 2 class A & B. Class A contains 1 int64, 1 int, 1 datetime, 6 strings, 1 byte[] and a list of Class B objects.

Class B contains 2 Int64, 1 enum (4values), 5 strings.

Class A and B have a master detail relationship between them. Class A can have 0 or more objects of Class B in its list.

These objects are used to store search results from our db.

We have a SOA architecture. The client can search withing a particular date range and with a fixed set of criteria. We use these on the service to gather the search results and push them to the client in batches. After sending each batch, we delete those objects from the service.

Problem:
If a user does a search that returns 200k results (Class A + Class B counts combined), the service memory consumption jumps 200mb. But if subsequent searches return only few results, the memory doesn’t come back to its previous state. When I look at the performance counters for the service, I see that lot of memory is taken up by gen2 objects.

Without trying to do a GC.Collect(), how can I make sure that that memory is returned more quickly? I though of using the IDisposable interface on Class A and Class B, but since most of the fields in both of them are strings, I don’t know how I can forcefully dispose them.

  • 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-26T00:25:44+00:00Added an answer on May 26, 2026 at 12:25 am

    You might want to consider attacking the problem from a different angle. Rather than trying to optimize low-level things like Garbage Collection details, why not take a step back and ask do you really need to return 200k results at once?

    If this is being displayed in a UI then showing 200k results is completely useless to a human being as that’s just way too much data. I’d suggest doing some kind of paging and only showing 100 at a time (and only retrieving 100 at a time from the service). Or maybe showing the user the first 100, then have them click a button if they really want to retrieve all 200k.

    Improvements like that are going to have a much bigger impact than micro-optimizing memory management.

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

Sidebar

Related Questions

Say I have a class named testThing: .testThing { background-color:#000000; float:left; height:50px; width:50px; }
lets say i have a background worker in a class that perform db query
I have created a button CSS class that uses background images with different positions
I have a 4x3 matrix where the class is set to blank (white background).
Background I have a container class which uses vector<std::string> internally. I have provided a
Background Let's say I have the following class: public class MyValue<T> { public T
BACKGROUND: I have a GridView based on a fairly complex Adapter class which extends
Background info I have a query regarding a questions from Sierra & Bates, SCJP
Background: I have a project where i need to create multiple objects that consume
Background: I have a complicated class with many variables. I have a sound and

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.