On 10/31/07, Adam Campbell <[EMAIL PROTECTED]> wrote: > > Hello, > > I've noticed some odd behavior running the wxLua sample script > "editor.wx.lua". If I run this script through the wxlua.exe and monitor the > process memory usage via the Windows task manager -- I'm seeing monolithic > growth of memory usage (seems like about 32KB a second). This memory usage > seems to be tied to UI events because after a minute or so of no UI activity > (I don't move the mouse cursor) the memory growth stops, only to resume > again after I move the mouse. What's even stranger is when I minimize the > editor window the memory usage shoots way down (although Virtual Memory > remains constant). > > Does anyone have a clue as to what is going on here? I'm concerned that a > wxLua script application that stays in Focus for a prolonged preiod of time > could slowly drain the system resources.
I think all you're seeing is the garbage collector running and yes they probably are the wxUpdateUIEvents. ---------- For debugging your own code you can use this function for k, v in pairs(wxlua.GetTrackedUserData()) do print(k, v) end http://wxlua.sourceforge.net/docs/wxluaref.html#wxlua_wxlua.i ---------- http://www.lua.org/manual/5.1/manual.html#pdf-collectgarbage >From how I understand the GC in Lua; "setpause" is factor of memory increase before running "setstepmul" speed of collector relative to mem allocation? Not sure. You can see it with this program. -------------------------- setpause = {110, 150, 200, 400} setstepmul = {125, 200, 400} for sp = 1, #setpause do for sm = 1, #setstepmul do collectgarbage("collect") collectgarbage("setpause", setpause[sp]) collectgarbage("setstepmul", setstepmul[sm]) a = os.time() for i = 1, 1E6 do local p = wx.wxPoint(0,0) end print("setpause: "..setpause[sp]..", setstepmul: "..setstepmul[sm]..", secs: "..tostring(os.time()-a)) end end -------------------------- setpause: 110, setstepmul: 125, secs: 6 setpause: 110, setstepmul: 200, secs: 6 setpause: 110, setstepmul: 400, secs: 5 setpause: 150, setstepmul: 125, secs: 8 setpause: 150, setstepmul: 200, secs: 9 setpause: 150, setstepmul: 400, secs: 10 setpause: 200, setstepmul: 125, secs: 9 setpause: 200, setstepmul: 200, secs: 21 setpause: 200, setstepmul: 400, secs: 28 setpause: 400, setstepmul: 125, secs: 40 setpause: 400, setstepmul: 200, secs: 43 setpause: 400, setstepmul: 400, secs: 38 setpause: 200, setstepmul: 800, secs: 9 setpause: 800, setstepmul: 200, secs: 8 setpause: 800, setstepmul: 800, secs: 13 It seems like you actually gain in running the garbage collector more often. The best numbers to use may be collectgarbage("setpause", 120) collectgarbage("setstepmul", 400) I have been thinking seriously about making the GC a little more aggressive by default. This is because Lua thinks that the userdata is of size void*, a pointer, but behind that can be a rather large object and there is no way to give a hint to the garbage collector about it's true size. This has been brought up on the Lua mailing list, but it doesn't seem like this will be added anytime soon. > As a side note, I don't observe the same behavior running the full blown > wxLua editor executable, only the script version (editor.wx.lua). That's because the wxLua editor is written in Lua, see samples/editor.wx.lua, and wxLuaEdit is in C++. Regards, John ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users