Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DW-23: Fixing System.OutOfMemoryException in x86 #104

Merged
merged 6 commits into from
May 15, 2024

Conversation

mee-ironsoftware
Copy link
Member

@mee-ironsoftware mee-ironsoftware commented May 7, 2024

Description

The root cause of the issue lies in the ExportBytes() function when attempting to return a large byte array containing a giant image (4958x7016 pixels). This high resolution consumes significant memory, leading to an OutOfMemoryException.

Fixing only SaveAs() function by change to use FileStream instead of byte[].

Doesn't have a good solution for ExportBytes() because we export a byte array out. To solve this issue on x86 please change to use ExportStream() instead.

Fixes #DW-23

Type of change

Please select the relevant option by placing an 'x' inside the brackets, like this: [x].

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🏗️ Internal/structural update (non-breaking change that improves code quality, organization, or performance)
  • 📚 This change requires a documentation update
  • 🚀 DevOps build chain modification for release
  • 🤖 DevOps build chain modification for CI

How Has This Been Tested?

Test locally using x86 and add x86 tests on DevOps (.NET472, .NET60, and .NET70)

Checklist:

Please run through the checklist as much as possible and mark the items completed by placing an 'x' inside the brackets, like this: [x].

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have successfully run all unit tests on Windows
  • I have successfully run all unit tests on Linux

ikkyuland and others added 6 commits May 2, 2024 11:51
…moryException`

`OutOfMemoryException` is causing by the giant array of byte which memory on x86 can't hold it.
- Set env.PROCESSOR_ARCHITECTURE to x86 to install on x86 arch
- Install .NET7 only on x86 arch it already install for x64

PR Validation: Add missing `.` when checking architecture
Copy link
Contributor

@first-ironsoftware first-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@mee-ironsoftware mee-ironsoftware merged commit 52ef0b0 into develop May 15, 2024
19 checks passed
@mee-ironsoftware mee-ironsoftware deleted the cast-anybitmap-out-of-memory-x86 branch May 15, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants