|
// Generation.h: interface for the Generation class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _HEAPMEMORY_H
#define _HEAPMEMORY_H
#include "StdAfx.h"
class Generation
{
friend class GC;
private:
// The generation number
int _GenerationNumber;
// Pointers to the objects in the generation
std::vector< void* > _Pointers;
// Points to the top of memory available in the generation
void* _pTopOfMemory;
// The generation allocates memory from this location
void* _pNextObjPtr;
// Returns maximum size available for one generation
enum { MaxSize = 1000 };
// Table of memory inside generation
BYTE MemoryTable[MaxSize];
public:
// Gets the remaining memory of the Generation
int GetRemainingMemory() const;
// Returns maximum memory that can be allocated for one generation
int GetTotalMemory() const { return MaxSize; }
// Allocates memory for an object and returns its void*
void* Allocate( size_t Size );
// Gets the generation number
int GetGenerationNumber() const { return _GenerationNumber; }
// Performs bitbybit copying
static void* CopyBitByBit( const void* pSourceLocation, size_t Size, Generation* pTargetGeneration );
void operator delete( void* v )
{
free( v );
}
public:
Generation( int GenNumber = 0 );
virtual ~Generation();
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.