Ariane Soft PPL2 Pocket Programming DataMite
Prev Previous Post   Next Post Next
  #1  
Old 11-02-2010, 12:14 PM
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default Memory leak in ReadString?

I have an application that reads lines from a text file, parses the string and writes a new text file depending on the input string;

The source file is 1.813MB in size (Not massive, but big) and is a dump from Active Directory (50 lines per record, blank line as next record marker) - There are 56,335 lines total in the file.

The destination is a .CSV file.

I open both files (Source as read only) (Destination as write)

Pseudo code:

While (FEOF(input) == 0)
line = readstring(input)

if (mid(line,0,13) == "printername: ")
output = output + Mid(line,14, length(line))
end

<6 more checks for specific lines in the input file>

if (mid(line,0,1) == " ") // end of this current record
writestring(output)
end

end

My app seeks through about 13 complete records then throws an exception error. (Access Violation at 0x40e223)

I cant see why, other than PPL is running out of memory.

Is there a known memory leak with ReadString?

I have tried loading the whole file into a string to manipulate as a list, but it too runs out of memory (How big can a string be? - Not 1.8MB I guess!)

Frustrating me now, as all I am trying to do is open a file, read the lines in succession then output to another file when criteria is found. - Not asking much!

Oh, and I have tried this in 1.53 and 2.2.1 and both do the same thing.

Any suggestions guys?

<EDIT> - Ok, so I have run my code on 2 different machines and get the same problem. Machine 1 is W7 with 3GB ram and Machine 2 is XPSP3 with 1GB ram. Both fall over at roughly the same place.

Got to be memory related as the machine with 1GB warned me about Virtual Memory being low, just before it fell over.

Last edited by Mike Halliday; 11-02-2010 at 01:25 PM.
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.
Copyright © 2009 www.ppl-lang.com - All rights reserved
Web Design by BR Web Consulting Ltd