AutoHotkey Community

It is currently May 27th, 2012, 11:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: August 2nd, 2010, 2:45 am 
Offline

Joined: February 24th, 2005, 8:45 am
Posts: 278
I am using the following to separate a bunch of text from a 110MB txt file:


Code:
SetBatchLines, -1
Process, Priority, , R
FileRead, file, ALL.txt

Loop, Parse, file, `n
{
   StringLeft, check, A_LoopField, 2
   If check = D:
      FileAppend, %A_LoopField%`n, Out.txt
      
}


But when I looked at AHK's memory usage, it is 232MB, instead of being around 120MB considering FileRead loaded the file in memory. Is AHK using another variable for Parse Loop?

[Moved from Bug Reports forum. ~jaco0646]

_________________
My small "thanks" to AHK in shape of these dedicated 3d images
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 2nd, 2010, 3:48 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
Yes, a parsing loop does make a copy of the text:
the loop... is operating on a temporary copy of the original contents.

In your case, a file reading loop would be superior in both performance and memory use.
Code:
SetBatchLines, -1
Loop, Read, ALL.txt, Out.txt
{
   StringLeft, check, A_LoopReadLine, 2
   If check = D:
      FileAppend, %A_LoopReadLine%`n
}

p.s. this thread should probaby be moved to 'Ask for Help'

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, MSN [Bot] and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group