Shell memory issue

Hi.

I’m splitting the calculation of a complex process in different Shells for getting multiprocess performance. It’s the first time I’m making something like this, so I’m a little confused about some of the steps.

I’be based on the same example described in Xojo page (WordCounter). In fact, I’ve use exactly the same code (with the modifications for adapting to my app) for making it running.

Each one of the shells is calculating a list of numbers I’m saving in a string (spaced with CHR(9) for easy conversion into a numeric array later on).

The software is running ok and working in multiprocess if the strings are small, but when the strings become large, they are not read 100%.

For example if the result of the Shell is a string of 11218 Bytes, the Main App get’s only the first 8192 Bytes. If the result of the shell is a string of 248 Bytes, the Main App get’s it perfectly.

I’m running the Shells in Asynchronous mode and getting the result using the DataAvailable event of the Shell.

It’s possible to specify the amount of memory for each Shell?, maybe the problem comes from here.

How could I ensure the Shell has finish writing all the data in the result?. I mean, is the “DataAvailable” event been launch when the data starts been available or when it’s finished and no more data is saved?, because the problem also comes from here.

Any idea of why is working with small amount of data but not with large amount of data?.

Witch part of my code would you like to take a look for knowing what I’m making wrong?.

Thanks in advance.

[quote=494016:@Juan Martorell]For example if the result of the Shell is a string of 11218 Bytes, the Main App get’s only the first 8192 Bytes. If the result of the shell is a string of 248 Bytes, the Main App get’s it perfectly.

I’m running the Shells in Asynchronous mode and getting the result using the DataAvailable event of the Shell.[/quote]
DataAvailable occurs when data is available, not when it is complete. That may be key to your issue.

To really ensure all the data reaches, you’d have to send the size of the data to the main process. As an alternate idea, you could use a terminator string to identify the end of the data.

I’m going to try it Thanks for the info

I’ve made it. With the terminator. I’ve had to create a temporal variable for storing each one of the incoming buffers until I find the terminator and then join all previous data. It’s working great. Thanks a lot for the tip