| title | max_variable_size Class | Microsoft Docs | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||
| ms.reviewer | ||||||||||||||
| ms.suite | ||||||||||||||
| ms.technology |
|
|||||||||||||
| ms.tgt_pltfrm | ||||||||||||||
| ms.topic | article | |||||||||||||
| f1_keywords |
|
|||||||||||||
| dev_langs |
|
|||||||||||||
| helpviewer_keywords |
|
|||||||||||||
| ms.assetid | 9f2e9df0-4148-4b37-bc30-f8eca0ef86ae | |||||||||||||
| caps.latest.revision | 18 | |||||||||||||
| author | corob-msft | |||||||||||||
| ms.author | corob | |||||||||||||
| manager | ghogen | |||||||||||||
| translation.priority.mt |
|
Describes a max class object that limits a freelist object to a maximum length that is roughly proportional to the number of allocated memory blocks.
class max_variable_size
| max_variable_size | Constructs an object of type max_variable_size. |
| allocated | Increments the count of allocated memory blocks. |
| deallocated | Decrements the count of allocated memory blocks. |
| full | Returns a value that specifies whether more memory blocks should be added to the free list. |
| released | Decrements the count of memory blocks on the free list. |
| saved | Increments the count of memory blocks on the free list. |
Header: <allocators>
Namespace: stdext
Increments the count of allocated memory blocks.
void allocated(std::size_t _Nx = 1);
| Parameter | Description |
|---|---|
_Nx |
The increment value. |
This member function adds _Nx to the stored value _Nallocs. This member function is called after each successful call by cache_freelist::allocate to operator new. The argument _Nx is the number of memory blocks in the chunk allocated by operator new.
Decrements the count of allocated memory blocks.
void deallocated(std::size_t _Nx = 1);
| Parameter | Description |
|---|---|
_Nx |
The increment value. |
The member function subtracts _Nx from the stored value _Nallocs. This member function is called after each call by cache_freelist::deallocate to operator delete. The argument _Nx is the number of memory blocks in the chunk deallocated by operator delete.
Returns a value that specifies whether more memory blocks should be added to the free list.
bool full();
true if _Nallocs / 16 + 16 <= _Nblocks.
This member function is called by cache_freelist::deallocate. If the call returns true, deallocate puts the memory block on the free list; if it returns false, deallocate calls operator delete to deallocate the block.
Constructs an object of type max_variable_size.
max_variable_size();
The constructor initializes the stored values _Nblocks and _Nallocs to zero.
Decrements the count of memory blocks on the free list.
void released();
This member function decrements the stored value _Nblocks. The released member function of the current max class is called by cache_freelist::allocate whenever it removes a memory block from the free list.
Increments the count of memory blocks on the free list.
void saved();
This member function increments the stored value _Nblocks. This member function is called by cache_freelist::deallocate whenever it puts a memory block on the free list.