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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:58:10+00:00 2026-05-12T06:58:10+00:00

Unless you’re programming parts of an OS or an embedded system are there any

  • 0

Unless you’re programming parts of an OS or an embedded system are there any reasons to do so? I can imagine that for some particular classes that are created and destroyed frequently overloading memory management functions or introducing a pool of objects might lower the overhead, but doing these things globally?

Addition
I’ve just found a bug in an overloaded delete function – memory wasn’t always freed. And that was in a not-so memory critical application. Also, disabling these overloads decreases performance by ~0.5% only.

  • 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-12T06:58:10+00:00Added an answer on May 12, 2026 at 6:58 am

    We overload the global new and delete operators where I work for many reasons:

    • pooling all small allocations — decreases overhead, decreases fragmentation, can increase performance for small-alloc-heavy apps
    • framing allocations with a known lifetime — ignore all the frees until the very end of this period, then free all of them together (admittedly we do this more with local operator overloads than global)
    • alignment adjustment — to cacheline boundaries, etc
    • alloc fill — helping to expose usage of uninitialized variables
    • free fill — helping to expose usage of previously deleted memory
    • delayed free — increasing the effectiveness of free fill, occasionally increasing performance
    • sentinels or fenceposts — helping to expose buffer overruns, underruns, and the occasional wild pointer
    • redirecting allocations — to account for NUMA, special memory areas, or even to keep separate systems separate in memory (for e.g. embedded scripting languages or DSLs)
    • garbage collection or cleanup — again useful for those embedded scripting languages
    • heap verification — you can walk through the heap data structure every N allocs/frees to make sure everything looks ok
    • accounting, including leak tracking and usage snapshots/statistics (stacks, allocation ages, etc)

    The idea of new/delete accounting is really flexible and powerful: you can, for example, record the entire callstack for the active thread whenever an alloc occurs, and aggregate statistics about that. You could ship the stack info over the network if you don’t have space to keep it locally for whatever reason. The types of info you can gather here are only limited by your imagination (and performance, of course).

    We use global overloads because it’s convenient to hang lots of common debugging functionality there, as well as make sweeping improvements across the entire app, based on the statistics we gather from those same overloads.

    We still do use custom allocators for individual types too; in many cases the speedup or capabilities you can get by providing custom allocators for e.g. a single point-of-use of an STL data structure far exceeds the general speedup you can get from the global overloads.

    Take a look at some of the allocators and debugging systems that are out there for C/C++ and you’ll rapidly come up with these and other ideas:

    • valgrind
    • electricfence
    • dmalloc
    • dlmalloc
    • Application Verifier
    • Insure++
    • BoundsChecker
    • …and many others… (the gamedev industry is a great place to look)

    (One old but seminal book is Writing Solid Code, which discusses many of the reasons you might want to provide custom allocators in C, most of which are still very relevant.)

    Obviously if you can use any of these fine tools you will want to do so rather than rolling your own.

    There are situations in which it is faster, easier, less of a business/legal hassle, nothing’s available for your platform yet, or just more instructive: dig in and write a global overload.

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

Sidebar

Related Questions

I do realize that I can do unless [1].empty? But I'm wondering if there
There is a banking site that I cannot login to unless I allow all
I noticed that unless I re-call VertexAttribPointer, there's not input to shaders after a
Unless I do the following in the authz file: [/some/path/to/trunk] * = r No
My view is that unless you need to change the basic structure of the
Unless I use the .toLocaleDateString() method, the function below returns a date that is
Unless I'm missing something, it seems that none of the APIs I've looked at
Unless it's not supposed to but I can't seem to get nth-child to acknowledge
I have a need (unless you can think of a better way) of passing
Unless this is HTML 5 where I can easily use history.pushState() to manipulate URL

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.