getRichText() memory leak?
- Posted by Bob Thompson <getter at ?astmai?.co.uk> May 15, 2008
- 648 views
Chris, I've noticed that the commit charge carries on increasing when getRichText() is run repeatedly using richedit50W on XP. Here's a demo. Any ideas? Regards, Bob
include Win32Lib.ew without warning --====================================================== constant win = createEx(Window, "demo", 0, 0, 0, 300, 200, 0, 0) constant tool_bar = createEx(ToolBar, "", win, 0, 0, w32Edge, 34, 0, 0) constant edit = createEx(RichEdit, "", win, 0, 0, w32Edge, {w32Edge, +34}, w32or_all({ES_NOHIDESEL}), 0) constant button1 = createEx(PushButton, "get_rich_text", tool_bar, 0, 0, 100, 30, 0, 0) constant button2 = createEx(PushButton, "clear_editor", tool_bar, 100, 0, 100, 30, 0, 0) constant button3 = createEx(PushButton, "reset_editor", tool_bar, 200, 0, 100, 30, 0, 0) setFont({button1, button2, button3}, "Arial", 9, Bold) --===================================================== sequence big_text, word big_text = {} word = {} --====================================================== for n = 1 to 1000000 do for m = 1 to 5 do word &= rand(26) + 96 end for word &= 32 big_text &= word word = {} end for setText(edit, big_text) --====================================================== procedure get_rich_text(atom self, atom event, sequence params) sequence selection selection = getRichText(edit, -1) end procedure setHandler(button1, w32HClick, routine_id("get_rich_text")) --====================================================== procedure clear_editor(atom self, atom event, sequence params) setText(edit, "") end procedure setHandler(button2, w32HClick, routine_id("clear_editor")) -- --====================================================== procedure reset_editor(atom self, atom event, sequence params) setText(edit, big_text) end procedure setHandler(button3, w32HClick, routine_id("reset_editor")) -- --====================================================== WinMain(win, Normal)