Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: [view] crashing...

From: didec:tiscali at: 16-Mar-2004 0:23

Re: [view] crashing...
> Can you provide any simple example of the memory leak so we can test it?
Strange that different guys can think about the same problem in the same time !! One ask about this kind of problem on the French Forum. In his case, memory of a face was not release as the face has a timer set on it (rate) and he doesn't hide the face before removing it from the parent/pane. So the timer was still running proving that the face was still here. I don't think it's your problem here. Anyway, I made this small program to test his problem (see at end). On my system, automatic GC occur when memory has grow to about 1.2MB (3.4 -> 4.6 -> 3.4MB). If button 1) is pressed, memory grow to 7.4Mo (the face use big image to be "memory visible"). same behaviour : GC occur after 1.2MB more. But freeing the face with 2) or 3) button doesn't recover memory (still 7.4MB mini). Clicking 1) again make memory grow again, but this time memory is recoverable, down to 7.4MB that still be the minimun. You can try clicking fast, here it goes only up to ~15.5MB Button 2) and 3) can show the timer problem if you un-comment the 'rate line in the add-face func. This code (may be) demonstrate that 'layout or one of the func used in the layout process hold some reference on value, probably in local var, and so, some memory. Hope this help a little bit. DideC --------CODE BELOW -------- View/new lay: layout [ b: box across text "Allocated memory (MB) :" info 100 rate 2 feel [ engage: func [f a e][f/text: to-string stats / 1000000 show f] ] below button 320 "1) add a big face with rate" [add-face] button 320 "2) Hide and remove big face with timer" [hide-face remove-face] button 320 "3) Just remove big face without hiding first" [remove-face] button 320 "4) recycle" [recycle] ] add-face: does [ b/pane: layout [ text "here" (make image! 1000x1000) ; rate 1 feel [ engage: func [f a e][print now/time] ] ] show lay ] hide-face: does [if object? b/pane [hide b/pane]] remove-face: does [ b/pane: none layout [text ""] ; try locking loaccal vars of layout on a smaller face show lay ] do-events