void * operator new( unsigned int iSize )
{
static unsigned char aMemPool[10000];
static unsigned iUsed = 0;
iUsed += iSize;
if( iUsed > 10000 )
{
return 0;
}
return &aMemPool[iUsed-iSize];
}
void MEM_UnitTest()
{
for( int i = 0; i < 100000; i++ )
{
int *piTest = new int;
*piTest = i;
delete piTest;
}
}
emin3m 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Salem 5,199 Posting Sage
vijayan121 1,152 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.