Recent

Author Topic: Application Auto Halt!!!  (Read 7450 times)

fjtrooper

  • New Member
  • *
  • Posts: 12
Application Auto Halt!!!
« on: May 06, 2009, 01:52:13 pm »
Good afternoon! I've made avery simple console program and the only function is execute another app every 1 minute forever. The problem is that sudenly the main app closes!

Someone can help please!!

Thanks

arnoldb

  • Jr. Member
  • **
  • Posts: 97
Re: Application Auto Halt!!!
« Reply #1 on: May 06, 2009, 02:07:45 pm »
If you cannot provide more information than "suddenly main app closes", very few people will be able to help you.

If you do not get any kind of message, try and make your main application to write a log file of the steps it is busy with, so that you can pinpoint where in your application the problem happens.

Also, check your source code to see if created objects are free'd when needed; it might be that you have are getting a n out-of-memory problem in your main application.

fjtrooper

  • New Member
  • *
  • Posts: 12
Re: Application Auto Halt!!!
« Reply #2 on: May 06, 2009, 02:13:25 pm »
Ok, I'll recheck objects. The program uses to halt when I start another app, it seems could be the system is out of memory? but the only app that closes is mine!  :(

fjtrooper

  • New Member
  • *
  • Posts: 12
Re: Application Auto Halt!!!
« Reply #3 on: May 06, 2009, 02:49:49 pm »
This is my code:

//////////////////

bucle:

  appath:=extractfilepath(paramstr(0));
  appath:=appath+'program.exe';

  CreateProcess(@appath, Nil, Nil, Nil, False, CREATE_NEW_CONSOLE, Nil, Nil,  StartupInfo,InfoDelProcesso);
 
goto bucle;   

/////////////////

Also I've "StopOnException:=True;" on Create

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Application Auto Halt!!!
« Reply #4 on: May 07, 2009, 08:07:02 am »
WOW, CreateProcess! It's been a long time since the last time I played with WinAPI.

Looking at your code... where's that "every 1 minute"? I only see an infinite loop calling CreateProcess without any delay. Surely it will run out of memory pretty soon.

For the log that arnoldb suggest, AFAIK every LCL program have that capability. Start your program with --debug-log=<log file> (Windows) or start the program from a terminal (Other OSes).

Use HeapTrace unit (-gh compiler option) to check for mem leaks.
« Last Edit: May 07, 2009, 08:09:53 am by Leledumbo »

fjtrooper

  • New Member
  • *
  • Posts: 12
Re: Application Auto Halt!!!
« Reply #5 on: May 08, 2009, 07:59:41 pm »
ooppsss,...  Yes!! I forgot to post "sleep" command. Yes I use an infinite loop with a sleep inside, which aprox is 1 minute.

 

TinyPortal © 2005-2018