in reply to win32::daemon memory leak

Hello tbsky,

Can you give example code for a service you run, together with the command sequence you issue to control service installation, etc.? So far, I’ve not been able to get your code to work — but that’s likely because I don’t know enough about the Win32::Daemon module. :-(

In the meantime, perhaps you could try a module such as Test::LeakTrace. Here’s how I would proceed:

BTW, the following isn’t very informative:

print "Failed to install service: $!\n";

From the documentation, the correct way to report failure is like this:

print 'Failed to install service: ', Win32::FormatMessage(Win32::Daemon::GetLastError()), "\n";

Also, you have use Fcntl;, but I don’t think it’s actually used anywhere, is it?

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Win32::Daemon memory leak
by tbsky (Novice) on Dec 23, 2015 at 08:13 UTC

    sorry the code is not clean. I have modify it. to run it please use the procedure below:

    1. use " -i" to install the "memory-leak" service to windows.

    2. use windows gui to start the service or use command "net start memory-leak" to start the service.

    3. use windows gui to watch the "perl.exe" process memory status.

    4. after testing. use windows gui to stop the service or use command "net stop memory leak" to stop the service.

    5. use " -r" to remove the service.

      I'm interested in the matter (abandoned services in Perl since the day of "service could not start in a timely fashion".. error)
      I have installed your service and now i'm monitoring it for the next 4 hours, with:
      #PID perl -E "for(1..240){system qq(tasklist /fi \"PID eq 17360\" /n +h);sleep 60}" # UPDATE: RESULTS perl.exe 17360 Services 0 + 9.136 K # 240x60 sec after.. perl.exe 17360 Services 0 + 16.768 K #it leaked 31.8K every minute

      UPDATE: The increment seems to me constant over time even if not so regular: The leak even if little is yet noticeable: the working set is passed fro 9.136K to 9.848K in 15 minutes. Private bytes also are arising. I'm using also Process Explorer. I think you need to investigate further. Have you some holidays? look at this article: identifying-memory-leak-with-process-explorer-and-windbg and share your results! in the meantime I have not enough time to investigate.
      I'll tell you more

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        thanks for the hint. I will spent my time to read your suggestion!