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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:45:51+00:00 2026-06-18T05:45:51+00:00

On this msdn page , it says The fewer objects allocated on the heap,

  • 0

On this msdn page, it says

The fewer objects allocated on the heap, the less work the garbage collector has to do. When you allocate objects, do not use rounded-up values that exceed your needs, such as allocating an array of 32 bytes when you need only 15 bytes.

Does anyone know why this recommendation is here (apart from the obvious – which I doubt is why they have this here)?

What’s the harm in allocating space rounded to a word boundary?

Does it have an effect on performance?

  • 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-18T05:45:52+00:00Added an answer on June 18, 2026 at 5:45 am

    Rounding up allocations was a strategy in the olden days of unmanaged code, before sophisticated heap managers became available. It reduced the ill effects of heap fragmentation, having a bunch of small empty blocks in the heap that can’t be combined in a bigger one. And thus having the program terminate with OOM with lots of unused memory. There’s no point to it left today, the Windows low fragmentation heap solved the problem, albeit that it rounds up allocations as well. Up to a multiple of 8 for small allocations. Available since XP and turned on by default for Vista and up.

    There’s no point to it when you have a garbage collector that can compact and get rid of the holes. You just give it more work to do, moving unused memory, without benefit.

    Heap fragmentation is not a completely solved problem in managed code, the Large Object Heap can end up having empty holes that are hard to re-use. The LOH doesn’t get compacted, too much data to move. And rounding up allocations for objects larger than 80 kilobytes actually could still make sense. You’d only do that when a memory profiler shows you that you’ve got an LOH problem. At which point you should first consider moving to a 64-bit operating system.

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

Sidebar

Related Questions

In the comments of this page: http://msdn.microsoft.com/en-us/library/12s31dhy%28v=VS.90%29.aspx ..it says that TransmitFile() cannot be used
This page, http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx , in the thread section, says that a async method does
The MSDN page for byte says that you can declare a byte like this:
This page (MSDN) says in the first step: Alternatively, you can also use configuration
So, as described on this msdn page , when you define a Connection String
There's this ... MSDN page, IQueryable(Of T) Interface . Can you do a better
The T-SQL MSDN page states The timestamp syntax is deprecated. This feature will be
As per this MSDN article: W3C Extended Log File Format (IIS 6.0) It says
I found a contradiction in MSDN regarding initial values for thread-local storage. This page
I was looking at this page on MSDN: Maximum Capacity Specifications for SQL Server

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.