나는 https://github.com/davedelong/CHCSVParserCHCSVParser의 메모리 사용을 어떻게 제한합니까?
그것은 설치 아주 쉬웠다 작품에서 CHCSVParser를 사용하여 코어 데이터로 30메가바이트의 CSV 파일을 가져 오기 위해 노력하고있어,하지만 파일을 구문 분석하는 것 같이 메모리를 많이 먹는다. 과도한 메모리 사용은 -substringWithRange:
//return nil to indicate EOF or error
if ([currentChunk length] == 0) { return nil; }
NSRange charRange = [currentChunk rangeOfComposedCharacterSequenceAtIndex:chunkIndex];
NSString * nextChar = [currentChunk substringWithRange:charRange];
chunkIndex = charRange.location + charRange.length;
return nextChar;
내가
-drain
모든 1,000,000 문자를 호출하는 함수에 오토 릴리즈 풀을 추가 할 수 있었다
하지만, 처리량, 통화, -nextCharacter
의 끝에서 오는 특히 것 같다 내려 간다.
다른 아이디어가 있습니까? 아마도 Dave DeLong일까요? :-)
주변 루프 및 자동 풀 풀의 코드를 조금 더 추가하십시오. –
흥미 롭습니다! 좀 더 자세히 살펴보고 다시 생각해 보겠습니다. –