Error while opening document from bytes 'bad allocation'

This article was translated from English: Does it need improvement?
Translated
View the article in English

大規模な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
' 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
$vbLabelText   $csharpLabel

プラットフォームターゲットをx64に設定することで、アプリケーションは64ビットシステムの拡張されたメモリ容量を活用できるようになり、大きなPDFファイルに関連するメモリ割り当ての問題を防ぐことができます。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
Nuget ダウンロード 16,154,058 | バージョン: 2025.11 ただ今リリースされました