_CrtSetDebugFillThreshold

디버그 함수에서 버퍼 채우기 동작을 제어하는 임계값을 검색하고 수정합니다.

구문

size_t _CrtSetDebugFillThreshold( size_t newThreshold );

매개 변수

newThreshold
새 임계값 크기(바이트)입니다.

반환 값

이전 임계값입니다.

설명

일부 보안 강화 CRT 함수의 디버그 버전은 전달된 버퍼를 특수 문자(0xFE)로 채웁니다. 이 채우기 문자는 잘못된 크기가 함수에 전달된 사례를 찾는 데 도움이 됩니다. 그러나 성능 또한 줄어듭니다. 성능을 향상시키려면 임계값보다 newThreshold 큰 버퍼에 버퍼 채우기를 사용하지 않도록 설정하는 데 사용합니다_CrtSetDebugFillThreshold. 값 0은 newThreshold 모든 버퍼에 대해 사용하지 않도록 설정합니다.

기본 임계값은 SIZE_T_MAX입니다.

영향을 받는 함수 목록은 다음과 같습니다.

요구 사항

루틴에서 반환된 값 필수 헤더
_CrtSetDebugFillThreshold <crtdbg.h>

이 함수는 Microsoft 전용입니다. 호환성에 대한 자세한 내용은 호환성을 참조하세요.

라이브러리

C 런타임 라이브러리의 버전만 디버그합니다 .

예시

// crt_crtsetdebugfillthreshold.c
// compile with: cl /MTd crt_crtsetdebugfillthreshold.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <crtdbg.h>

void Clear( char buff[], size_t size )
{
   for( int i=0; i<size; ++i )
      buff[i] = 0;
}

void Print( char buff[], size_t size )
{
   for( int i=0; i<size; ++i )
      printf( "%02x  %c\n", (unsigned char)buff[i], buff[i] );
}

int main( void )
{
   char buff[10];

   printf( "With buffer-filling on:\n" );
   strcpy_s( buff, _countof(buff), "howdy" );
   Print( buff, _countof(buff) );

   _CrtSetDebugFillThreshold( 0 );

   printf( "With buffer-filling off:\n" );
   Clear( buff, _countof(buff) );
   strcpy_s( buff, _countof(buff), "howdy" );
   Print( buff, _countof(buff) );
}
With buffer-filling on:
68  h
6f  o
77  w
64  d
79  y
00
fe  ■
fe  ■
fe  ■
fe  ■
With buffer-filling off:
68  h
6f  o
77  w
64  d
79  y
00
00
00
00
00

참고 항목

디버그 루틴