Пример #1
0
static void* OperatorNew( size_t s )
{
    if ( !using_alloc_set )
    {
        simulate_possible_failure();
        alloc_count++;
    }

    char *p = AllocateBlock(s);

    if ( gTestController.TrackingEnabled()
            && gTestController.LeakDetectionEnabled()
            && !using_alloc_set )
    {
        using_alloc_set = true;
        EH_ASSERT( alloc_set().find( p ) == alloc_set().end() );
        alloc_set().insert( p );
        using_alloc_set = false;
    }

    return p;
}
Пример #2
0
void _STLP_CALL operator delete(void* s)
# endif
{
    if ( s != 0 )
    {
        if ( !using_alloc_set )
        {
            alloc_count--;

            if ( gTestController.TrackingEnabled() && gTestController.LeakDetectionEnabled() )
            {
                using_alloc_set = true;
                allocation_set::iterator p = alloc_set().find( (char*)s );
                EH_ASSERT( p != alloc_set().end() );
                alloc_set().erase( p );
                using_alloc_set = false;
            }
        }
# if ! defined (NO_FAST_ALLOCATOR)
        if ( !gFastAllocator.Free( s ) )
# endif
            EH_CSTD::free(s);
    }
}