나는 다음과 같은 명령을 사용하여 몇 가지 문제가 있어요 :PowerShell을 얻을 컨텐츠에 OutOfMemory
Get-Content -Encoding Byte -ReadCount 0 $FilePath_All, $FilePath_Int | Set-Content -Encoding Byte -Force $ImpDayFPath
파일이 200~300메가바이트 사이에있다.
OutOfMemoryException가 발생합니다. 기계에는 8Gb가 있지만 사용 된 오류는 4Gb뿐입니다.
은 내가 Documentation 내가 벤치 마크 테스트 성능 예제를 찾을 수 없었기 때문에 난 그냥 0을 쓴-ReadCount<Int64>
Specifies how many lines of content are sent through the pipeline at a time.
The default value is 1. A value of 0 (zero) sends all of the content at one time.
This parameter does not change the content displayed, but it does affect the time
it takes to display the content. As the value of ReadCount increases, the time
it takes to return the first line increases, but the total time for the operation
decreases. This can make a perceptible difference in very large items.
...
파일이 더 많거나 적은 270k 라인을 포함 확인. 내가 외부 루프를 가지고 있고 시간이 O (n^2)가 될 것이기 때문에 하나씩가는 것이 성능에 문제를 일으킬 수있다.
내가 사용할 수있는 가치에 대해 알고 싶습니까?
레거시 파일의 내용을 가져와 새 파일에서 수정되었거나 (LastWriteTime) 수정되었는지 확인해야합니다. 파일은 텍스트 기반입니다. – blfuentes
전체 파일을 한 번에 읽고 (ReadCount 0), 한 줄씩 비교할 수 있으면 많은 메모리를 절약 할 수 있습니다. – ojk
예, 압니다. 설명서를 확인했습니다. http://technet.microsoft.com/en-us/library/hh849787.aspx 그러나이 문제에 익숙하지 않아 "공통 가치"를 선택할 수 없습니다. – blfuentes