Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
/*
* Fixed-Size Small Block Allocator */
#ifndef DUI_BASE_SBALLOC_H_INCLUDED
#define DUI_BASE_SBALLOC_H_INCLUDED
#pragma once
#include "duialloc.h"
namespace DirectUI {
#define SBALLOC_FILLCHAR 0xFE
struct ISBLeak // Leak detector, not ref counted
{ virtual void AllocLeak(void* pBlock) = 0; };
struct SBSection { SBSection* pNext; BYTE* pData; };
class SBAlloc { public: static HRESULT Create(UINT uBlockSize, UINT uBlocksPerSection, ISBLeak* pisbLeak, SBAlloc** ppSBA); void Destroy();
void* Alloc(); void Free(void* pBlock);
SBAlloc() { } virtual ~SBAlloc();
private: bool _FillStack();
UINT _uBlockSize; UINT _uBlocksPerSection; SBSection* _pSections; BYTE** _ppStack; // Free block cache
int _dStackPtr; ISBLeak* _pisbLeak; };
} // namespace DirectUI
#endif // DUI_BASE_SBALLOC_H_INCLUDED
|