Blad podczas otwierania dokumentu z bajtow 'bad allocation'
Przetwarzanie duzych dokumentow PDF moze byc kluczowe dla niektorych firm.
Podczas uzywania IronPDF do ladowania istniejacego pliku PDF, IronPDF przydziela czesc pamieci do przechowywania zaladowanego PDF. Aplikacje dzialajace na 32-bit maja limit pamieci 2 GB na proces. Ladowanie pliku PDF wiekszego niz 500 MB moze przekroczyc to ograniczenie, powodujac wyjatek 'bad allocation'.
Komunikat bledu:
IronPdf.Exceptions.IronPdfNativeException: 'Error while opening document from bytes: 'bad allocation'.
Rozwiązanie
Aby to rozwiazac, prosze ustawic aplikacje do uruchamiania na 64-bit. Pozwala to aplikacji na dostep do wiekszej przestrzeni pamieci, unikajac bledu 'bad allocation'. Postepuj wedlug tych krokow, aby skonfigurowac projekt Visual Studio na platforme docelowa 64-bit:
// 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
Ustawiajac docelowa platforme na x64, aplikacja moze wykorzystac rozszerzona pojemnosc pamieci systemu 64-bit, zapobiegajac problemom z przydzialem pamieci zwiazanym z duzymi plikami PDF.

