바이트에서 문서를 여는 중 '잘못된 할당' 오류가 발생했습니다.
대용량 PDF 문서를 처리하는 것은 일부 기업에게 매우 중요할 수 있습니다.
IronPDF 사용하여 기존 PDF 파일을 불러올 때, IronPDF 불러온 PDF를 저장하기 위해 메모리의 일부를 할당합니다. 32비트 시스템 에서 실행되는 애플리케이션은 프로세스당 2GB 의 메모리 제한이 있습니다. 500MB보다 큰 PDF 파일을 로드하면 이 제한을 초과하여 '잘못된 할당' 예외가 발생할 수 있습니다.
예외 메시지:
IronPdf.Exceptions.IronPdfNativeException: 'Error while opening document from bytes: 'bad allocation'.
해결책
이 문제를 해결하려면 애플리케이션을 64비트로 실행되도록 설정하십시오. 이를 통해 애플리케이션은 더 큰 메모리 공간에 접근할 수 있으므로 '잘못된 할당' 오류를 방지할 수 있습니다. Visual Studio 프로젝트를 64비트 플랫폼을 대상으로 구성하려면 다음 단계를 따르십시오.
// Open your project in Visual Studio
// In the Solution Explorer, right-click on your project and select 'Properties'
// Navigate to the 'Build' tab
// Select 'x64' from the 'Platform target' dropdown
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
// Save your changes and rebuild the project
// Open your project in Visual Studio
// In the Solution Explorer, right-click on your project and select 'Properties'
// Navigate to the 'Build' tab
// Select 'x64' from the 'Platform target' dropdown
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
// Save your changes and rebuild the project
' Open your project in Visual Studio
' In the Solution Explorer, right-click on your project and select 'Properties'
' Navigate to the 'Build' tab
' Select 'x64' from the 'Platform target' dropdown
(Of PropertyGroup) (Of PlatformTarget) x64</PlatformTarget> </PropertyGroup>
' Save your changes and rebuild the project
플랫폼 대상을 x64로 설정하면 애플리케이션이 64비트 시스템의 확장된 메모리 용량을 활용할 수 있으므로 대용량 PDF 파일과 관련된 메모리 할당 문제를 방지할 수 있습니다.

