⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bigmem.h

📁 绝对好东东
💻 H
字号:
// BigMem.h: interface for the CBigMem class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BIGMEM_H__C452052F_9E19_4C5D_9C4A_4E3F9D522B2A__INCLUDED_)
#define AFX_BIGMEM_H__C452052F_9E19_4C5D_9C4A_4E3F9D522B2A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define SLOT_COUNT 16
#define SLOT_SIZE  (1 * 1024 * 1024)

#define BIGMEM_LAST		 0x1a371a37
#define BIGMEM_ALLOCATED 0xa110caed
#define BIGMEM_FREED	 0xf2eed
typedef struct tagBigMemBlock
{
	DWORD dwAllocFlags;
	DWORD dwSize;
}
TBigMemBlock;

class CBigMem  
{
protected:
	PBYTE	m_pb[SLOT_COUNT];		//max memory is 16 M
	int		m_nSlotSize;
	int		m_nSlotUsed;
	int		m_nPosAllocated;
	int		m_nRef;

	BOOL _AllocSlot(int nSlotSize);
	void _FreeAllResources();

protected:
	//you can not delcare CBigMem vars, you must use method: Create
	CBigMem(int nSlotSize = SLOT_SIZE);
public:
	~CBigMem();

	PVOID Alloc(int nSize);
	PVOID Realloc(PVOID pvOld, int nNewSize);
	void Free(PVOID pv);

	static CBigMem* Create(int nSlotSize = SLOT_SIZE);
	int Refrence();
	int Release();

#if defined(_DEBUG)
	void ReportMemLeak();
#else
	#define ReportMemLeak (void)0
#endif
};

#endif // !defined(AFX_BIGMEM_H__C452052F_9E19_4C5D_9C4A_4E3F9D522B2A__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -