--- In [email protected], "quantiworks" <quanticwo...@...> wrote:
>
> Can anyone point me to where to start?
>
> Program in question is Opera 10 alpha which currently has a
> problem with ram usage, it keeps growing as time goes by and
> I need to restart it.
>
> Since I like to use alpha's and beta's this will serve to future versions.
> What I'd like to do is,
> when ram usage gets to x, offer me an option to close it in order
> to save data, then restart it.
> So, what do I need?
>
> monitor the application
> get ram usage values
> if statement
> and Do
>
> Is that correct or I'm totally missing the point here?
>
Maybe this will get you started.
There may be other options, but here is one way to get the memory usage
reported in Task Manager.
local processid=win.getprocessid(win.handle("=Opera"))
clip.clear
local wmicmd= ;;+
?"/c wmic /output:clipboard process "++processid ;;+
++" get workingsetsize"
file.runwait(0, env("COMSPEC"), wmicmd, "", "hide")
local output=regex.m1(clip.get, ?"\d+", "\\0")
win.debug("workingsetsize: "++output/1024)
Instead of writing to the clipboard you could write to file and read it from
the file or use the pipe plugin and get it from there.
You could monitor it using an event.
Opera Starts -> get the processid and start an event via autorun
every x time periods, the event would run a script for the processid
script:
- see if the processid is still running, if not destroy the event
- get the workingsetsize
- if workingsetsize > max show an ontop messagebox with restart options and
destroy the event
- depending on the selected option, start a new event for the existing
processid or kill the process and restart opera (restarting would trigger a new
event for the new process id).
Regards,
Sheri