CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How new/delete stores the internal info about the allocated buffer?

  1. #1
    Join Date
    Nov 2010
    Posts
    54

    How new/delete stores the internal info about the allocated buffer?

    I am using C++ new/delete operators to allocate/deallocate the buffers. I think for each allocated buffer, there should be an additional info block stores the size and other info about the buffer. How to know more details about this info block? I need to override these two operators and find such an info block is useful to my implementation.

    Thanks

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,118

    Re: How new/delete stores the internal info about the allocated buffer?

    To find the size of allocated buffers see your other question here http://forums.codeguru.com/showthrea...located-buffer

    As far as I am aware other info re allocated memory is not available.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.1)

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How new/delete stores the internal info about the allocated buffer?

    "there is no portable way to do so".

    going into specific compilers there are ways by which you can get free store information or even go lower level and get OS heap management information.
    none of those will typically work when custom allocators or overloaded operator new are in play.

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How new/delete stores the internal info about the allocated buffer?

    Or alternatively, that may actually be the way you do get at it.

    install your own global new/delete operators and do any sort of allocation tracking you want from there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)