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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:28:47+00:00 2026-05-31T03:28:47+00:00

I am profiling an application(using VS 2010) that is behaving badly in production. Once

  • 0

I am profiling an application(using VS 2010) that is behaving badly in production. Once of the recommendations given by VS 2010 is:

Relatively high rate of Gen 1 garbage collections is occurring. If, by
design, most of your program’s data structures are allocated and
persisted for a long time, this is not ordinarily a problem. However,
if this behavior is unintended, your app may be pinning objects. If
you are not certain, you can gather .NET memory allocation data and
object lifetime information to understand the pattern of memory
allocation your application uses.

Searching on google gives the following link=> http://msdn.microsoft.com/en-us/library/ee815714.aspx. Are there some obvious things that I can do to reduce this issue?I seem to be lost here.

Double-click the message in the Errors List window to navigate to the
Marks View of the profiling data. Find the .NET CLR Memory# of Gen 0
Collections and .NET CLR Memory# of Gen 1 Collections columns.
Determine if there are specific phases of program execution where
garbage collection is occurring more frequently. Compare these values
to the % Time in GC column to see if the pattern of managed memory
allocations is causing excessive memory management overhead.

To understand the application’s pattern of managed memory usage,
profile it again running a.NET Memory allocation profile and request
Object Lifetime measurements.

For information about how to improve garbage collection performance,
see Garbage Collector Basics and Performance Hints on the Microsoft
Web site. For information about the overhead of automatic garbage
collection, see Large Object Heap Uncovered.

  • 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-31T03:28:48+00:00Added an answer on May 31, 2026 at 3:28 am

    The relevant line there is:

    To understand the application’s pattern of managed memory usage, profile it again running a.NET Memory allocation profile and request Object Lifetime measurements.

    You need to understand how many objects are being allocated by your application and when, and how long they are alive for. You’re probably allocating hundreds (or thousands!) of tiny objects inside a loop somewhere without really thinking about the consequences of reclaiming that memory when the references fall out of scope.

    http://msdn.microsoft.com/en-us/library/ms973837.aspx states:

    Now that we have a basic model for how things are working, let’s
    consider some things that could go wrong that would make it slow. That
    will give us a good idea what sorts of things we should try to avoid
    to get the best performance out of the collector.

    Too Many Allocations

    This is really the most basic thing that can go wrong. Allocating new
    memory with the garbage collector is really quite fast. As you can see
    in Figure 2 above is all that needs to happen typically is for the
    allocation pointer to get moved to create space for your new object on
    the “allocated” side—it doesn’t get much faster than that. However,
    sooner or later a garbage collect has to happen and, all things being
    equal, it’s better for that to happen later than sooner. So you want
    to make sure when you’re creating new objects that it’s really
    necessary and appropriate to do so, even though creating just one is
    fast.

    This may sound like obvious advice, but actually it’s remarkably easy
    to forget that one little line of code you write could trigger a lot
    of allocations. For example, suppose you’re writing a comparison
    function of some kind, and suppose that your objects have a keywords
    field and that you want your comparison to be case insensitive on the
    keywords in the order given. Now in this case you can’t just compare
    the entire keywords string, because the first keyword might be very
    short. It would be tempting to use String.Split to break the keyword
    string into pieces and then compare each piece in order using the
    normal case-insensitive compare. Sounds great right?

    Well, as it turns out doing it like that isn’t such a good idea. You
    see, String.Split is going to create an array of strings, which means
    one new string object for every keyword originally in your keywords
    string plus one more object for the array. Yikes! If we’re doing this
    in the context of a sort, that’s a lot of comparisons and your
    two-line comparison function is now creating a very large number of
    temporary objects. Suddenly the garbage collector is going to be
    working very hard on your behalf, and even with the cleverest
    collection scheme there is just a lot of trash to clean up. Better to
    write a comparison function that doesn’t require the allocations at
    all.

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

Sidebar

Related Questions

I recently began profiling an osgi java application that I am writing using VisualVM.
I'm profiling my application using VisualVM and I see that the heap size increased
I have a perm gen memory leak, that I know. Profiling using jvisualvm shows
I am profiling an application suddenly using a lot of memory, and i am
I am working on profiling a legacy application using Spring AOP and I want
Is there any recommended Java application profiling tutorial? I am now using JProfiler and
while profiling a java application that calculates hierarchical clustering of thousands of elements I
I was experimenting a lot with application profiling lately (using Visual Studio Performance Wizard).
I have network application that handles about 40k msg/sec written using netty framework and
I was using JProfiler for profiling of my application, as it is a huge

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.