Hello guys,

I am developing an application that manipulates big strings in memory, basically the app filter, sort, extract some strings from plain text files.

The text files am currently working of is 4MB, but am putting a maximum files size of 10 MB in mind as i work.

First i have an open feature, so my app loads the text file to a textbox, and when i click on a button, it starts to do its work.

Observing a compiled version of my app, its cpu usage goes up as high as 99%, and the memory usage jumps high to 100MB.

My system has 767MB memory 2.4GH processor power.

In order to make the GUI responsive i put the code in a dll, and before starting the process here is the code i use

vb Code:
  1. 'create buffer
  2.  sTemp = Space$(Len(txtOut.Text)) ' this line take a minute of more for 3MB text
  3. 'copy from textbox to buffer
  4.  retval = lstrcpy(sTemp, txtOut.Text) ' this take about 15 seconds for the same 3mb text

where i need your help is to improve this routines so as to take less cpu and memory usage

Is there a way i can assign max memory my app can use?

Please any ideas are welcomed