Jump to content



Photo
* * * * * 12 votes

Dev thread: Road to DX9


  • Please log in to reply
2087 replies to this topic

#721 toxie

toxie

    VPF Veteran

  • VP Dev Team
  • PipPipPipPipPipPip
  • 5,734 posts
  • Location:berlin, germany

  • Flag: Germany

  • Favorite Pinball: AFM

Posted 25 February 2014 - 08:36 AM

just to make sure that i won't miss anything when i'll finish up the cabinet branch: could you please check what is different with your own VPM version (all changes you have) and send me a PM with a patch?

Thanks!



#722 mukuste

mukuste

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 854 posts

  • Flag: ---------

  • Favorite Pinball: Centaur

Posted 25 February 2014 - 10:16 AM

 

I would like to see this issue resolved to be honest as it was causing some (infrequent) crashes on my system.

Despite the residual issues that remain, this beta build is now my main version, so Great work and please keep it up!

Thanks

 

 

Ok, I found and fixed some more longstanding memory leaks in the image loading code, so it should be much better now. Thanks for reporting that.

 

I still have my doubts if the VPM object gets released in the table script, I hope someone experienced with scripting can chime in.



#723 BananaBoat

BananaBoat

    Enthusiast

  • Members
  • PipPipPip
  • 228 posts

  • Flag: Australia

  • Favorite Pinball: Tron LE

Posted 25 February 2014 - 10:27 AM

Do you want me to test the latest fixes ;)

Sent from my HTC_PN071 using Tapatalk
 


Edited by BananaBoat, 25 February 2014 - 12:05 PM.


#724 bent98

bent98

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,077 posts
  • Location:NY

  • Flag: United States of America

  • Favorite Pinball: Roadshow, Haunted House, Safe Cracker

Posted 25 February 2014 - 12:41 PM

 

 

I would like to see this issue resolved to be honest as it was causing some (infrequent) crashes on my system.

Despite the residual issues that remain, this beta build is now my main version, so Great work and please keep it up!

Thanks

 

 

Ok, I found and fixed some more longstanding memory leaks in the image loading code, so it should be much better now. Thanks for reporting that.

 

I still have my doubts if the VPM object gets released in the table script, I hope someone experienced with scripting can chime in.

 

 

Can you explain more about the VPM object leak?



#725 mukuste

mukuste

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 854 posts

  • Flag: ---------

  • Favorite Pinball: Centaur

Posted 25 February 2014 - 12:59 PM

 

 

 

I would like to see this issue resolved to be honest as it was causing some (infrequent) crashes on my system.

Despite the residual issues that remain, this beta build is now my main version, so Great work and please keep it up!

Thanks

 

 

Ok, I found and fixed some more longstanding memory leaks in the image loading code, so it should be much better now. Thanks for reporting that.

 

I still have my doubts if the VPM object gets released in the table script, I hope someone experienced with scripting can chime in.

 

 

Can you explain more about the VPM object leak?

 

 

When you start a table which uses VPM, there is a line in the script which creates the VPM controller object. This internally uses the COM system, it loads up the vpinmame.dll and asks it to create the controller. The controller is then used throughout gameplay to control the table elements via the ROM.

 

What I wonder is, when the table player (but not VP itself) is stopped, is this controller object released again? Does the script need to do this manually or does the scripting engine take care that it is released? Or is it never released, just staying in limbo and eating up resources until you quit the VP process?



#726 arngrim

arngrim

    DJ Force Feedback

  • VIP
  • 2,188 posts
  • Location:Charleroi, Belgium

  • Flag: Belgium

  • Favorite Pinball: Monster bash



Posted 25 February 2014 - 01:08 PM

well, try to update your vpinmame.dll, rename, delete after you quit a table but not exited vp, you won't be able to do it if i remember.

It is the same for DOF, and probably B2S.Server.

but when using a frontend, it closes vp totally



#727 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 25 February 2014 - 01:37 PM

What would be the exit command to add to the Vb script For The table.

W p ulna this be something easy to add to the player code. When the exit command is called to the player a quick code snippet to end all com objects started by the script.

I'm not sure just wondering. I know we don't add any kind of exit to pin mame in the table script. Just a pause when etc is pressed

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#728 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 25 February 2014 - 01:37 PM

What would be the exit command to add to the Vb script For The table.

W p ulna this be something easy to add to the player code. When the exit command is called to the player a quick code snippet to end all com objects started by the script.

I'm not sure just wondering. I know we don't add any kind of exit to pin mame in the table script. Just a pause when etc is pressed

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#729 toxie

toxie

    VPF Veteran

  • VP Dev Team
  • PipPipPipPipPipPip
  • 5,734 posts
  • Location:berlin, germany

  • Flag: Germany

  • Favorite Pinball: AFM

Posted 25 February 2014 - 01:39 PM

Yup, VPM always just stays there. And as it never was a big issue in practice, so far nobody ever looked into this in detail.

 

But would be cool if it would be fixed, as currently the "official" recommendation is that basically after each table run that uses VPM, one should restart VP.  :/



#730 arngrim

arngrim

    DJ Force Feedback

  • VIP
  • 2,188 posts
  • Location:Charleroi, Belgium

  • Flag: Belgium

  • Favorite Pinball: Monster bash



Posted 25 February 2014 - 01:51 PM

Maybe not just vpm, but simply the active controller

#731 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 25 February 2014 - 02:10 PM

Well even for originals if you use the new ultradmd won't that stay open also.

To Xie is there some sort of command the player can use to exit vp or any other com object.

Or if a method can be added to vp called table exit. Or something. So we can unload any come that are called from the script.

Although I don't know what the Vb syntax for unloading the controler would be

Edited by unclewilly, 25 February 2014 - 02:12 PM.

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#732 fuzzel

fuzzel

    spaghetti code

  • VP Dev Team
  • PipPipPipPipPip
  • 2,818 posts

  • Flag: Germany

  • Favorite Pinball: yes I have

Posted 25 February 2014 - 02:28 PM

Hmm shouldn't "set controller=nothing" on the table_exit function do the trick? The garbage collection should kick in and frees the resource then, but only if the reference count is zero. So if you have multiple variables pointing to VPM or you assigned VPM also to another variable then you should set this variable to nothing too.


Edited by fuzzel, 25 February 2014 - 02:28 PM.


#733 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 25 February 2014 - 02:33 PM

How would you go about testing that.
Does the vp process stay in the task manager?

And is there a sub table_exit() routine we can call from the script?

I'd do some tests but I'm on a 18 hour work day today

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#734 fuzzel

fuzzel

    spaghetti code

  • VP Dev Team
  • PipPipPipPipPip
  • 2,818 posts

  • Flag: Germany

  • Favorite Pinball: yes I have

Posted 25 February 2014 - 02:38 PM

You can define it in you script like:

sub [tablename]_exit()

   controller.stop()

   set controller = nothing

end sub

 

After the player quits try to move your vpinmame.dll to another folder. If another process uses the dll you get an access violation error message ;) I haven't tested it myself but normaly this is the way how you can free resources in vbs scripts.



#735 mukuste

mukuste

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 854 posts

  • Flag: ---------

  • Favorite Pinball: Centaur

Posted 25 February 2014 - 02:48 PM

I wonder though, isn't the scripting engine initialized and destroyed for every player instance anyway? This should mean that the VB environment is destroyed and all variables automatically go "out of scope" automatically, and the VPM controller should be released. This is what this here says at least:

 

http://stackoverflow...t-up-by-setting



#736 fuzzel

fuzzel

    spaghetti code

  • VP Dev Team
  • PipPipPipPipPip
  • 2,818 posts

  • Flag: Germany

  • Favorite Pinball: yes I have

Posted 25 February 2014 - 03:01 PM

Yes the script engine is destroyed but you load a separate resource not from the actual script engine but from the VBA/COM server which is an own process which isn't destroyed at the end of the player ;) So my guess is that the server holds the resource even if the player is terminated. Perhaps you can force to unload the dll by using the nothing-trick.



#737 mukuste

mukuste

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 854 posts

  • Flag: ---------

  • Favorite Pinball: Centaur

Posted 25 February 2014 - 03:15 PM

VPinMAME is implemented as an in-process server (DLL), so there is no separate process. I just had a look through the code: PinTable::StopPlaying() calls CodeViewer::EndSession(), which in turn calls CleanUpScriptEngine(), which releases the IActiveScript object and then reinitializes it. So in theory everything should get cleaned up, unless there is some messup with the reference counting...



#738 ClarkKent

ClarkKent

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,552 posts

  • Flag: Austria

  • Favorite Pinball: Q*Bert's Quest, Red's and Ted's Road Show, Dialed In, Big Bang Bar

Posted 25 February 2014 - 04:09 PM

Another test report: White Water has some sever layer problems.

 

Hope to see a new test version soon to be able to test toxie's key fix.



#739 Sir Cheddar

Sir Cheddar

    His Sharpness

  • VIP
  • 383 posts

  • Flag: ---------

  • Favorite Pinball: Tales of the Arabian Nights



Posted 25 February 2014 - 04:25 PM

You can define it in you script like:

sub [tablename]_exit()

   controller.stop()

   set controller = nothing

end sub

 

After the player quits try to move your vpinmame.dll to another folder. If another process uses the dll you get an access violation error message ;) I haven't tested it myself but normaly this is the way how you can free resources in vbs scripts.

I just tested this.

 

It doesn't seem VP keeps a file handle open on vpinmame.dll, I can use the windows explorer to rename or move the dll while the table is running.

 

VPinMAME.Controller: If I rename the file while vpinmame is active and stop the emulation I get an error message when I start the emulation again.

B2S.Server: If I rename the file while vpinmame is active and stop the emulation I don't get an error message when I start the emulation again. The table runs with vpinmame active.

 

set controller = nothing doesn't seem to make a difference in both cases.


Edited by Sir Cheddar, 25 February 2014 - 04:25 PM.


#740 bent98

bent98

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,077 posts
  • Location:NY

  • Flag: United States of America

  • Favorite Pinball: Roadshow, Haunted House, Safe Cracker

Posted 25 February 2014 - 08:41 PM

Another test report: White Water has some sever layer problems.

 

Hope to see a new test version soon to be able to test toxie's key fix.

Yes that layering order is going to be a big issue for compatibility.