Memory Leak

rollisoj

New member
Joined
Jul 3, 2007
Messages
2
Programming Experience
3-5
I have a VB Windows application that uses the shell command to do various operations...custom exes, etc. Here is an example of my code...

Shell("c"\mycustomexe", AppWinStyle.Hide)

I can monitor the processes and see the cmd process get spawned. Once my customexe finished executing the cmd closes as expected. The problem is that not all the memory is freed up after the cmd process completes. Over time, it starts to add up. Once I stop the Windows application that is periodically spawning these exes, the memory comes back.

As a workaround, I used SQL Server's xp_cmdshell command to kick off the exe instead of shell. This works and does not leak memory, but I would rather use the shell command.

Any ideas how I can get the shell command to return its memory to Windows?

Thanks!
 
Try the .Net Process class instead of legacy Shell function.
 
Back
Top