Re: Process & memory usage guru question
- From: j.a. harriman <jeffrey_no_spam_alias@xxxxxxxxxxxxx>
- Date: Mon, 6 Nov 2006 14:25:02 -0800
Sorry to be slow about getting back, busy and all that.
It will take me a little time (ok more time) to come up with some coding
examples.
As far as thread pools go, AppA has an item to process, it calls the
CreateProcess to execute cmd.exe to start AppB. AppB directly calls pkzip
through CreateProcess and does not use the cmd.exe. When the zip and file
moves are completed, AppB's process terminates. AppA logs info that it
completed and AppA releases the thread.
I talked to someone about calling the cmd.exe, he states there were "issues"
when the AppB EXE was called directly, but cannot recall what they were.
Unfortunately, this shop never adopted the try-catch logic.
I will post additional items as time permits, but there are leaks that need
to be cleaned up first. I have downloaded the eval copy of Software
Verification's Memory Validator.
Thanks. Jeff
"dan" wrote:
It looks like you are starting processes at 2 levels: AppA launches AppB and.
AppB launches pkzip. Do you use CreateProcess in both cases? If yes, could
you provide some code samples of how you start the processes and how you
wait for them to complete?
As somone else already pointed out, do not use cmd.exe unless absolutely
necessary (e.g. to run other scripts prior to pkzip, etc.). If you have to
run cmd.exe then you might consider using "/c" option.
Do you have a pool of re-usable threads in AppB or are threads created as
needed?
Does your app install any termination handlers (e.g. unhanded exception
filter)?
What version of VC do you use?
"j.a. harriman" <jeffrey_no_spam_alias@xxxxxxxxxxxxx> wrote in message
news:8D2CB790-D1C9-40E8-A436-B7481AA15E90@xxxxxxxxxxxxxxxx
The AppB in my original post does do more than zip files. All sorts of
proprietary stuff, but zipping is done for the vasty majority of files it
processes.
I am still uncertain as to why AppA is exiting unexpectedly.
My current plan is to attach ADPLUS in crash mode by having the operator
run
the command file to attach it as soon as he sees in the AppA program log
that
AppB's are failing.
In AppA we are actually checking for a successful return code from AppB.
And what happens is we begin getting large numbers of AppB failures in
AppA
which are reported in the AppA program log which eventually exits for ??
reason. I beleive we have an error message returned in AppB when it fails
but it is empty.
Jeff
"dan" wrote:
I'd agree with what you are saying but in a different context. I can't
see
how you can take advantage of all the goodies that come with
CreateProcess() when you simply want to run pkzip to compress files. I'd
still recommend ShellExectueEx() for someone who does not want to deal
with
start-up info and process information structures, does not care/want to
deal
with handles, etc. Calling ShellExecuteEx() is almost as simple as
calling
exec(), system(), spawn(), etc. used to be.
"Pete Delgado" <Pete@xxxxxxxxx> wrote in message
news:%23lHDVPR%23GHA.1784@xxxxxxxxxxxxxxxxxxxxxxx
"Dan" <dan@xxxxxxx> wrote in message
news:uA163XJ%23GHA.3456@xxxxxxxxxxxxxxxxxxxxxxx
I agree. Jeff's initial post implied problems with running pkzip to
compress a bunch of files. For that kind of task, ShelExecuteEx()
should
be more than sufficient. But as you said, sometimes you need to go low
level and use CreateProcess(). If you do that though you need to - as
with any low level API - be more careful because there is more room for
mistakes. On the other hand you get more control (e.g. speed up freeing
up
the process by closing main thread of process info before waiting on
process handle).
Actually, the control that I'm speaking about with CreateProcess are
things like being able to add the process to a job object and setting
limits on the process within the job, being able to control how
handles
are inherited etc. ShellExecuteEx gives you some useful shell
functionality such as finding the default application for a file for
you
as well as incrementing the application usage count for the application
so
that if you are using adaptive menus you will have the correct
applications appearing on the menu in the correct order.
-Pete
- Prev by Date: Re: 1) CDC 2) ComboBox Numbers Only 3) DoModal and CPropertyShee
- Next by Date: Re: Microsoft Visual C++ 6.0 Professional Edition--What's in the box?
- Previous by thread: Re: ModifyMenu
- Next by thread: RE: How to build an interface like File Manager?
- Index(es):
Relevant Pages
|