Esempio n. 1
0
	// DebugAllocator::unaligned_realloc
	void * DebugAllocator::unaligned_realloc( void * i_address, size_t i_new_size )
	{
		const size_t old_size = _do_check( i_address ); // the return value is valid only if m_heading_nomansland_size >= sizeof( void * )

		void * const old_block = address_sub( i_address, m_heading_nomansland_size );

		void * const new_block = dest_allocator().unaligned_realloc( old_block, i_new_size + m_heading_nomansland_size + m_tailing_nomansland_size );

		if( new_block == nullptr )
			return nullptr;

		void * const user_block = address_add( new_block, m_heading_nomansland_size );

		void * const user_block_end = address_add( user_block, i_new_size );

		if( old_block != new_block )
		{
			_set_nomansland( new_block, m_heading_nomansland_size, user_block );
		}

		_set_nomansland( user_block_end, m_tailing_nomansland_size, user_block );

		if( m_heading_nomansland_size >= sizeof( void * ) )
		{
			*reinterpret_cast< void * * >( new_block ) = _invert_address( user_block_end );

			if( i_new_size > old_size )
				_fill_memory( m_new_memory_fill_mode, address_add( user_block, old_size ), i_new_size - old_size );
		}

		return user_block;
	}
Esempio n. 2
0
	// DebugAllocator::unaligned_free
	void DebugAllocator::unaligned_free( void * i_address )
	{
		const size_t old_size = _do_check( i_address ); // the return value is valid only if m_heading_nomansland_size >= sizeof( void * )

		void * const block = address_sub( i_address, m_heading_nomansland_size );

		if( m_heading_nomansland_size >= sizeof( void * ) )
			_fill_memory( m_deleted_memory_fill_mode, block, old_size + m_heading_nomansland_size + m_tailing_nomansland_size );
		else
			_fill_memory( m_deleted_memory_fill_mode, block, m_heading_nomansland_size + m_tailing_nomansland_size );

		dest_allocator().unaligned_free( block );
	}
Esempio n. 3
0
	void CheckType(
		ProgramName program,
		GLint location,
		StrCRef identifier
	) const
	{
		_do_check(
			_type_matches,
			ProgVarTypeOps<tag::Uniform>::GetType(
				program,
				location,
				identifier
			),
			program,
			location,
			identifier
		);
	}
Esempio n. 4
0
	// DebugAllocator::get_block_size
	bool DebugAllocator::get_block_size( void * i_address, size_t * o_size ) const
	{
		*o_size = _do_check( i_address ); // the return value is valid only if m_heading_nomansland_size >= sizeof( void * )

		return m_heading_nomansland_size >= sizeof( void * );
	}
Esempio n. 5
0
	// DebugAllocator::unaligned_dbg_check
	void DebugAllocator::unaligned_dbg_check( void * i_address )
	{
		_do_check( i_address );
	}
Esempio n. 6
0
	// DebugAllocator::dbg_check
	void DebugAllocator::dbg_check( void * i_address )
	{
		_do_check( i_address );
	}