Erreur lors de l'ouverture d'un document à partir d'octets "mauvaise allocation"
Le traitement de documents PDF volumineux peut être crucial pour certaines entreprises.
Lors de l'utilisation d'IronPDF pour charger un fichier PDF existant, IronPDF alloue une partie de la mémoire pour stocker le PDF chargé. Les applications fonctionnant en 32 bits ont une limite de mémoire de 2 Go par processus. Le chargement d'un fichier PDF de plus de 500 Mo peut dépasser cette limitation, entraînant une exception de 'mauvaise allocation'.
Message d'exception :
IronPdf.Exceptions.IronPdfNativeException: 'Error while opening document from bytes: 'bad allocation'.
Solution
Pour résoudre ce problème, veuillez configurer l'application pour qu'elle s'exécute en 64 bits. Cela permet à l'application d'accéder à un espace mémoire plus important, évitant ainsi l'erreur de 'mauvaise allocation'. Suivez ces étapes pour configurer votre projet Visual Studio pour cibler une plate-forme 64 bits :
// 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
En définissant la cible de la plate-forme sur x64, l'application peut utiliser la capacité de mémoire étendue d'un système 64 bits, évitant ainsi les problèmes d'allocation de mémoire liés aux fichiers PDF volumineux.

