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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:34:09+00:00 2026-06-13T02:34:09+00:00

I see on http://msdn.microsoft.com/en-us/library/ee292117.aspx and http://msdn.microsoft.com/en-us/library/ee292134.aspx that Microsoft provides macros and classes for specialized

  • 0

I see on http://msdn.microsoft.com/en-us/library/ee292117.aspx and http://msdn.microsoft.com/en-us/library/ee292134.aspx that Microsoft provides macros and classes for specialized allocators, but I’m not sure what each of the caching strategies are, how to use them. Can someone explain when to use each of these parts?

  • Cache Templates
    • cache_freelist – The cache_freelist template class maintains a free list of memory blocks of size Sz. When the free list is full it uses operator delete to deallocate memory blocks. When the free list is empty it uses operator new to allocate new memory blocks. The maximum size of the free list is determined by the class max class passed in the Max parameter. Each memory block holds Sz bytes of usable memory and the data that operator new and operator delete require.
    • cache_suballoc – The cache_suballoc template class stores deallocated memory blocks in a free list with unbounded length, using freelist<sizeof(Type), max_unbounded>, and suballocates memory blocks from a larger chunk allocated with operator new when the free list is empty. Each chunk holds Sz * Nelts bytes of usable memory and the data that operator new and operator delete require. Allocated chunks are never freed.
    • cache_chunklist – This template class uses operator new to allocate chunks of raw memory, suballocating blocks to allocate storage for a memory block when needed; it stores deallocated memory blocks in a separate free list for each chunk, and uses operator delete to deallocate a chunk when none of its memory blocks is in use. Each memory block holds Sz bytes of usable memory and a pointer to the chunk that it belongs to. Each chunk holds Nelts memory blocks, three pointers, an int and the data that operator new and operator delete require.

I’ve written several allocators myself, but this documentation is just… confusing.

  • 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-13T02:34:11+00:00Added an answer on June 13, 2026 at 2:34 am

    Wow, they really garbled the documentation, didn’t they? (I wrote that code when I was at Dinkumware)

    The allocators here are policy-based: you can specify a caching policy and a synchronization policy.

    The basic idea is to make it easier to write allocators that use internal caches and can be synchronized across threads. There are half a dozen predefined allocators; their names all begin with allocator_. Use them if they fit your needs. In the MSDN stuff, look at the first paragraph of the description of the particular allocator; don’t read the “Remarks”, where they talk about ALLOCATOR_DECL;.

    You can also use that code to create your own allocators that use the pre-defined caching strategies (templates whose names begin with cache_) and synchronization strategies (templates whose names begin with sync_), or that use your own caching template and synchronization template. Getting a usable allocator from these pieces is a bit tedious, so the header provides ALLOCATOR_DECL as a convenient way to produce all the necessary boilerplate without having to write it yourself. ALLOCATOR_DECL takes three arguments: the name of the cache template to use, the name of the synchronization template to use, and the name of the allocator that you’re creating. So instead of writing

    template <class T> class name
        : public Dinkum::allocators::allocator_base<T, sync<cache > >
        {
        public:
            name() {}
            template <class U> name(const name<U>&) {}
            template <class U> name& operator = (const name<U>&)
                {return *this; }
            template <class U> struct rebind
                {    /* convert a name<T> to a name<U> */
                typedef name<U> other;
                };
        };
    

    you would write ALLOCATOR_DECL(cache, sync, name);. allocator_base does the heavy lifting; the allocator itself has to be a derived type, so that it can handle rebind correctly. (The Dinkum in that code comes from the Dinkumware documentation; I don’t know what namespace the Microsoft stuff puts these names in, but presumably the macro puts the right name there).

    For the cache templates:

    • cache_freelist maintains a linked list of node-sized blocks; the maximum size of the list is set by the template parameter Sz, and node allocation is managed with operator new and operator delete.
    • cache_suballoc adds another layer that manages a block of Nelts node blocks, all allocated as a single blob; allocation of a new element looks first to the free list, and if there is nothing free, allocates a new blob. Memory blocks are not deleted until the allocator is destroyed.
    • cache_chunklist allocates memory in blobs (like cache_suballoc), but doesn’t use a common free list; when a block is released it goes back into the free list for its blob. When all of a blobs blocks have been released, the blob itself is deleted.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see from http://msdn.microsoft.com/en-us/library/aa140060(v=office.10).aspx that data throttle value for Excel 2002 is 2 seconds.
http://msdn.microsoft.com/en-us/library/ms181765.aspx I see the sql below from above link: SELECT BusinessEntityID, SalariedFlag FROM HumanResources.Employee
See the code sample from MSDN: ( http://msdn.microsoft.com/en-us/library/b1yfkh5e(v=VS.100).aspx ) // Design pattern for a
It is said here http://msdn.microsoft.com/en-us/library/fa13yay7%28v=VS.90%29.aspx (see also http://msdn.microsoft.com/en-us/library/s4wcexbc%28VS.90%29.aspx ) Use this option if you
msft compilers for C++ support explicit overriding (see http://msdn.microsoft.com/en-us/library/ksek8777.aspx ) // could be declared
Looking at table on http://msdn.microsoft.com/en-us/library/y1z022s1%28v=vs.80%29.aspx#_core_collection_shape_features I can not see a MFC collection for the
I am playing with an MSDN sample to do memory stress testing (see: http://msdn.microsoft.com/en-us/magazine/cc163613.aspx
This page describes all steps to edit RC: http://msdn.microsoft.com/en-us/library/dd456813.aspx Those are easy steps, pretty
You can get common controls custom resource data ( see controlData section: http://msdn.microsoft.com/en-us/library/aa380902(v=VS.85).aspx )
As stated here http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.onvalidatingpassword.aspx When the ValidatingPassword event has completed, the properties of the

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.