バイト '不正な割り当て' からドキュメントを開くときにエラーが発生しました。
大規模なPDFドキュメントを処理することは、一部の企業にとって非常に重要です。
既存のPDFファイルを読み込むためにIronPDFを使用すると、IronPDFは読み込まれたPDFを保存するためのメモリ領域を割り当てます。 "32ビット"で動作するアプリケーションには、プロセスごとに2 GBのメモリ制限があります。 500 MBを超えるPDFファイルを読み込むと、この制限を超え、"bad allocation"例外が発生する可能性があります。
例外メッセージ:
IronPdf.Exceptions.IronPdfNativeException: 'Error while opening document from bytes: 'bad allocation'.解決策
これを解決するには、アプリケーションを64ビットで実行するように設定してください。 これにより、アプリケーションはより広いメモリ空間にアクセスできるようになり、"bad allocation"エラーを回避できます。 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プラットフォームターゲットをx64に設定することで、アプリケーションは64ビットシステムの拡張されたメモリ容量を活用できるようになり、大きなPDFファイルに関連するメモリ割り当ての問題を防ぐことができます。






