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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:03:59+00:00 2026-06-07T02:03:59+00:00

I want performant run-time memory metrics so I wrote a memory tracker based on

  • 0

I want performant run-time memory metrics so I wrote a memory tracker based on overloading new & delete. It basically lets walk your allocations in the heap and analyze everything about them – fragmentation, size, time, number, callstack, etc. But, it has 2 fatal flaws: It can’t track memory allocated in other DLLs and when ownership of objects is passed to DLLs or vice versa crashes ensue. And some smaller flaws: If a user uses malloc instead of new it’s untracked; or if a user makes a class defined new/delete.

How can I eliminate these flaws? I think I must be going about this fundamentally incorrectly by overloading new/delete, is there a better 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-07T02:04:00+00:00Added an answer on June 7, 2026 at 2:04 am

    The right way to implement this is to use detours and a separate tool that runs in its own process. The procedure is roughly the following:

    1. Create memory allocation in a remote process.
    2. Place there code of a small loader that will load your dll.
    3. Call CreateRemoteThread API that will run your loader.
    4. From inside of the loaded dll establish detours (hooks, interceptors) on the alloc/dealloc functions.
    5. Process the calls, track activity.

    If you implement your tool this way, it will be not important from what DLL or directly from exe the memory allocation routines are called. Plus you can track activities from any process, not necessarily that you compiled yourself.

    MS Windows allows checking contents of the virtual address space of the remote process. You can summarize use of virtual address space that was collected this way in a histogram, like the following:

    enter image description here

    From this picture you can see how many virtual allocation of what size are existing in your target process.

    enter image description here

    The picture above shows an overview of the virtual address space usage in 32-bit MSVC DevEnv. Blue stripe means a commited piece of emory, magenta stripe – reserved. Green is unoccupied part of the address space.

    You can see that lower addresses are pretty fragmented, while the middle area – not. Blue lines at high addresses – various dlls that are loaded into the process.

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

Sidebar

Related Questions

Basically, I want a check to run every time I append or prepend to
I got a new requirement from the business about real time data/statistics. They want
For performance purposes I want to write to memory, where an external application can
Basically I want an arbitrarily large stack. I know that's not possible, but could
I want create some type of ASP.NET (C# 2.0) Metrics class to help monitor
Assume that i have written a program in C++ without using RTTI and run-time
I want to test performance of my code on both jvm types -client and
I want to use performance monitors to determine when a file is being accessed
I want to perform performance measurement of a change I want to make to
In SQL Server when I want to check performance, I clear all buffers -

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.