Re: Invoking[Fork and exec] a new script from main GUI, freezes parent UI application....

On Apr 19, 2007, at 4:21 AM, Ashwin Ramachandran wrote:

Hi All,
I have an application, in which there is a menu item to display a log window. This log[textview] window shows all the log debugs collected so far from the application. All the log debugs are written to a file by the main application and this text window displays the contents of that log file.

Currently, whenever the menu item is clicked, I am forking and execing a script to display this text window. However, whenever the menu item is clicked, I observe that my main UI freezes.

First, track down *where* it freezes --- does the function doing the fork() return immediately? A very simple technique to track this down is to litter the code with prints and see which ones come out when.

My main UI application itself, typically takes around 3minutes to start. I am not sure on the exact reason, why it takes a long time. But possiblities are: a. The main application has close to 50,000 lines of code, b. A number of external Perl modules are used.

The strace command is often good for helping narrow down the search for long startup times. 50k plus modules *is* a lot of code for a perl app, but three minutes seems excessive. You're probably doing too much work too many times or something simple like that.

Would this a possible reason, why my main UI freezes, when a fork and exec happens?

What you've posted isn't enough context. (Please do not post the full program, as none of us will have the time to dig into it.) Are you doing a wait() or waitpid() for this child somewhere? Is your background process bogging down the machine and starving cycles from the UI?

Also, is there any other way in which this can be done? Would it a good idea, to have
the text window to be a part of the main UI application itself?

As it's not clear what you're trying to do, it's hard to say. Is there a reason to use custom code to show the log? Are you doing partial file reads to keep from loading the whole log file into memory? Do you parse the log for filtering or searching features? Or are you just displaying it? Launching a text editor may be easier...

One, two, free, four, five, six, sebben, eight, nine, ten, elebben, twull, fourteen, sickteen, sebbenteen, eightteen, elebbenteen, fiffeen, elebbenteen!
  -- Zella, aged three, counting to twenty.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]