Shell in class method results in memory leakage

Can anybody perhaps tell me how I can resolve this, if it’s something I’m doing on my end!? I basically have a simple console application. I noticed that when calling multiple shell commands, my application’s memory consumption started to climb… and continued to do so until I quit the application. Here’s what I know:

These two functions together (basically me just handling the shell command in an external method, which I’ve simplified for verification) leads to a memory leak:

[code]Function processShell(shellCommand as memoryBlock) As memoryBlock

dim systemShell as new shell

systemShell.execute(shellCommand)
return trim(systemShell.result) 'return trimmed results

End Function

Function Run(args() as String) As Integer

const THREAD_IDLE_INTERVAL = 128

coreSystem = new systemFramework

// - keep main thread running
do
app.doEvents(THREAD_IDLE_INTERVAL)
stdOut.write coreSystem.processShell(“ps aux | grep myApp | grep -v grep”) + endOfLine
loop

End Function[/code]

If I just handle the shell command in the run event itself, no memory leak:

[code]Function Run(args() as String) As Integer

const THREAD_IDLE_INTERVAL = 128

dim testShell as new shell

// - keep main thread running
do
app.doEvents(THREAD_IDLE_INTERVAL)
testShell.execute(“ps aux | grep myApp | grep -v grep”)
stdOut.write testShell.result + endOfLine
loop

End Function[/code]

What do you think is going on? I like to use memoryBlocks instead of string so I can manipulate the data easier if necessary, but changed those to string and still have the memory leaks. I’ve also passed the shell response to a string variable, nullified the shell object before leaving the external method and passed the resulting string, and same issue.

Well, after literally about 5 hours of trying to fix this solution (and figure out its cause) I was able to determine the following:

 systemShell.execute(shellCommand)

if shellCommand was a string, there is no memory leak
if shellCommand was a memoryBlock, memory leak was present

the following also resulted in a memory leak (which I thought was odd):

 systemShell.execute(shellCommand.stringValue(0, shellCommand.size))

So, not sure if it’s a Xojo issue… or if I need to stop using memoryBlock to pass string variables (even though I have legitimate reasons why I prefer to use them). The .stringValue clause; however, should not have resulted in a memory leak. Question now, is this a potential bug and should I submit a feedback?