尝试在笔记本电脑上安装 Fedora 时如何解决 System.OutOfMemoryException 问题?

How to troubleshoot System.OutOfMemoryException while trying to install Fedora on laptop?

我正在笔记本电脑上安装 Fedora Live Workstation,但卡在了步骤 "3.3.1. Verifying checksums on Windows systems" item "5.Calculate the downloaded image's checksum. This will take a while!"。 Windows PowerShell 不断抛出以下异常:

$download_checksum = [System.BitConverter]::ToString($sha256.ComputeHash([System.IO.File]::ReadAllBytes("$PWD$image"))).ToLower() -replace '-', ''
Eccezione durante la chiamata di "ReadAllBytes" con "1" argomento/i: "Generata eccezione di tipo 'System.OutOfMemoryException'." 
(Exception during the call of "ReadAllBytes" with "1" argument:"Generate exception type 'System.OutOfMemoryException'.")
In riga:1 car:104 (In line:1 char:104)
+ $download_checksum = [System.BitConverter]::ToString($sha256.ComputeHash([System.IO.File]::ReadAllBytes <<<< ("$PWD$image"))).ToLower() -replace '-', ''
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

我不精通Windows Powershell,也不是一个非常熟练的程序员,但为了解决这个问题,我提出了一些假设。如果它们不相关,请纠正我。

  1. 如果此异常的原因是硬件(例如,RAM 内存不足以处理计算),是否有任何变通方法,例如将计算分成更小的步骤以允许计算机处理更小的信息块?

  2. 是否有可能是解释器在将指令调整到 powershell 中时由于编译错误而溢出?


一些重要信息可能是:

MS 似乎没有很好的内存管理。校验和验证是可选的,windows-方式太复杂了。

If the cause of this exception is the hardware (e.g., insufficient RAM memory to process the computation), are there any workarounds like splitting the computation into smaller steps allowing the computer to handle smaller chuncks of information?

不知道有什么合理的方法。

我会通过刻录 iso(相信没有错误)、启动到 live-CD 并在 Linux 下进行校验和来解决这个问题,这太容易了。

不要将整个文件读入内存。改为这样做:

$filename = Join-Path $PWD $image

$sha256 = New-Object Security.Cryptography.SHA256CryptoServiceProvider

$stream = (Get-Item $filename).OpenRead()
$hash = $sha256.ComputeHash($stream)
$stream.Close()

$download_checksum = [BitConverter]::ToString($hash).ToLower() -replace '-'