Postby RobertG » Fri Jan 16, 2009 4:38 pm
It would be nice to know what the reason really is?? we can se that several DLL are unloaded and loaded between the movies. and it always looses a handle ? MemoryValidator doesn't detect it as a leakage but we can clearly see that it is growning between the Flash Movies/Clips and Memory validator points out the allocation of Handle is done in the FPC_LoadOCXCodeFromMemory / FPC_LoadRegisteredOCX() (I have tried both with same problem), after couple of days our Windows gets out of resources (HANDLES)... connected with DLL
Main Architecture of flash player.
Well we have a cycle for each movie where we did the following
but in our case it also includes a creation of a new thread.
This is done because if we would like to play multiple movies on different screens and timeing of the FPS to be more accurate independent from main app, etc.
while(true)
{
Creating new thread from main app
example :
if (_flashThread == 0)
_flashThread = reinterpret_cast<HANDLE>(::_beginthreadex( NULL, NULL, &ThreadFunc, _flashThreadData, 0, (unsigned *)&_threadID));
check / frame when movie finnished
trigger a close for thread.
DWORD dwRet = WaitForSingleObject( _flashThread, INFINITE ); // Kill thread from thread proc()
(NOTE THREAD WILL DO ALL THE CLEAN UP FOR FLASH, REG Window and Flash Window) flash isn't handled from the mian thread!
}
ThreadFunc()
{
FPC_LoadOCXCodeFromMemory
...
CreateWindowEx
...
FPC_LoadMovie
...
// Loop ThreadProc handling Win pumps etc.
PLay Movie .
// When a teardown is detected
Cleanup => Destroy Flash Window & Destroy Reg Window
FPC_UnloadCode
Exit thread...
}
TEMPORARY SOLUTION SO FAR:
I have a temporary solution that is to statically load OCX once and reuse during app lifetime. (Reusing same OCX for all clips).
Seems to work well, but I am unsure how it will cope with multiple movies though. I haven't tested it yet.
However by loading OCX statically it seems to be able to survive when windows being out of resources example:
I have started 26 Explorers ,Windows outlook Excell etc.. and got a message box that Windows is out of resources, And the flash player is still doing well where previously it would give mee NULL handles and failed bitmap captures or failed to start/load movies etc.
We can now also se the with static load of ocx DLL Handle Leakage have stopped.
Huh.. hope it helps you a little bit.
Br Rob