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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:54:25+00:00 2026-06-09T16:54:25+00:00

I have a performance counters reporter class that holds in multiple members different lists.

  • 0

I have a performance counters reporter class that holds in multiple members different lists. Is there a neat way to tell the class the memory limit of its consumption (to be bullet proof case the lists will be pushed with enormous amount of data), or should I go to each member and change it to blocked list? (and this is less dynamic in a way)

  • 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-09T16:54:26+00:00Added an answer on June 9, 2026 at 4:54 pm

    What you’re asking doesn’t make sense. How could a class limit its memory consumption?

    Consider: you have a public property that is a list of data. You set the value of that property to be a 2GB set of data but the class is limited to 100MB. How does the class decide what data to throw away? What happens to the data that’s thrown away? How does the rest of your program deal with the fact that half its data has disappeared?

    None of these questions are sensibly answered, because each program will have a different answer. For that reason, you’d have to implement such logic yourself.

    However, more importantly, you should consider this: if I create a List<int> that contains 2GB of data, and assign this list to a property of your “reporter class,” the memory consumption of your reporter class doesn’t change. This is because your reporter class has a property that is a List<int>, and what that means is that the property stores the memory address of a List<int> that is held somewhere else in the heap. This memory address – a pointer to what we consider the “value” of the property – is fixed according to the architecture of your machine/application and will never change. It’s the same size when your pointer is null as it is when the pointer points to a 2GB list. And so in that sense, the memory consumption of your class itself won’t be as big as you think.

    You can redefine the question to say “when calculating consumption, include all objects pointed to by my properties” but this has its own problems. What happens if you assign the List<int> to a property on two different objects, each with its own memory limit?

    Also, if your reporting class has two properties that could hold large data, and I assign large values to each, how do you decide what to throw away? If I have a 100MB limit for the class, and assign 200MB of data to one property and 1GB of data to the other, which data do I truncate? What would happen if I then cleared one of the properties – I now have “spare” memory consumption but data is irretrievably lost.

    In short: this is a very complex requirement to request. You’d have to create your own logic to implement this, and it’s unlikely you’ll find anything “standard” to handle it, because no two implementations would be the same.

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

Sidebar

Related Questions

I have a web service that creates it's own single instance performance counters. When
Hi, I have a WCF(TCP/IIS7) application that needs to add performance counters on startup,
Under Windows, performance counters have different names, depending on the operating system language. For
All: I am using some custom Performance Counters that I have created. These are
I have a WCF service that updates the value of two performance counters. The
I have several apps that need to create and write to Performance Counters. One
I have a C# process that as part of it's role reads performance counters
Does windows have performance counters to measure statistics of a dialup connection? Opening up
I have a performance counter category. The counters in this category may change for
We have some unit tests which work with performance counters (specifically creating new categories)

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.