AArhin / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

DWS guardian thread can leak executions #277

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enable memory leak reporting.
2. Run a handful of scripts.
3. Shut down the program normally.

What is the expected output? What do you see instead?
Expected: no memory leaks.
Observed: TdwsGuardedExecution instances are leaking.

This appears to be happening because TdwsGuardedExecutionList does not have a 
concept of "OwnsObjects", so anything left in its list when Clear is called 
does not get freed.

Original issue reported on code.google.com by masonwhe...@gmail.com on 27 May 2012 at 12:55

GoogleCodeExporter commented 9 years ago
Would you have a sample project that reproduces the issue? Or more details?
The unit tests do what you describe and don't have those leaks...

Original comment by zar...@gmail.com on 28 May 2012 at 12:18

GoogleCodeExporter commented 9 years ago
The program where I found this was a custom Web server that's too complicated 
(and too proprietary) to upload here as a sample project.  Requests come in 
from Indy, each one in its own thread, and they run scripts.  Sometimes one 
script will call out into native-code-land to handle something specialized 
which invokes a different script interpreter with different units attached to 
it, (there are a total of 5 different TDelphiWebScript components in the 
server, each providing different sandboxes,) and everything runs correctly and 
without errors.

Under this setup, there's generally 1 TdwsGuardedExecution instance getting 
leaked when the server is shut down.  Adding a simple for loop into the guard 
thread's destructor to free any remaining execution objects seems to work 
without any problems.

Original comment by masonwhe...@gmail.com on 28 May 2012 at 4:21

GoogleCodeExporter commented 9 years ago
Could you provide a modification of the IndyWebServer demo that would reproduce 
the issue?
There shouldn't remain anything in the list, if there is something else, then 
it's has to be caused by another bug somewhere else, and just clearing the list 
content would just be hiding that issue under the carpet so to speak.

Original comment by zar...@gmail.com on 29 May 2012 at 7:59

GoogleCodeExporter commented 9 years ago
Closed pending further details

Original comment by zar...@gmail.com on 22 Jun 2012 at 3:18

GoogleCodeExporter commented 9 years ago
A potential issue with the guardian, when the guardian is freed before the 
execution it guards has been found & solved. Not sure if it was the same issue 
though.

Original comment by zar...@gmail.com on 29 Nov 2012 at 2:23