Re: [Oberon] ETH Oberon/Gadgets: System Freeze in unloading
Gadgets.Insert BasicGadgets.NewButton to Insert a button somewhere. Then I execute System.Free BasicGadgets~ makes the system freeze...
Felix wrote: Don't be so cruel to the poor Button. You have stolen its Handler. ;-) Seriously: The Problem is: When freeing a Module, Oberon checks if there are still other Modules depending on that module but it cannot check if Objects are still using any Allocated Memory in that Module. In that special case the allocated Memory was the Handler and moreover any type-checks and type-casts could't work since the Module did not exist any more (after successful freeing it) etc.
So the "solution" is: Do not System.Free a Module when its Objects are still displayed, since they are not deallocated and the Handler is called any time a Display.Broadcast (or update message) is sent (which is the case when new Viewers like a Trap-View are opened.)
Felix.
Thanks for the info. I see the problem. However, in several years of working with Oberon, I have only found three ways to produce C-like system freezes apart from using the unsafe SYSTEM feature: A) calling C programs from within Oberon B) passing very large arrays as value parameters in procedure headings C) unloading modules whereby some visual gadget is still hanging around somewhere, as mentioned above. I feel system stability is a prominent one of the many highlights of Oberon, so the points B and C hurt the more... Greetings Patrick
Hi Patrick
However, in several years of working with Oberon, I have only found three ways to produce C-like system freezes apart from using the unsafe SYSTEM feature: A) calling C programs from within Oberon B) passing very large arrays as value parameters in procedure headings C) unloading modules whereby some visual gadget is still hanging around somewhere, as mentioned above. I feel system stability is a prominent one of the many highlights of Oberon, so the points B and C hurt the more...
I agree. By the way problem B) occurs because the max stacksize of an Oberon.Thread (in Windows) is approx. like 100kB. I have increased that value to 1MB in my threads, but anyway, the best "solution" is to take VAR-pars or Pointers. As far as I know, in Windows-Oberon it is a Windows-Problem, since the Windows-thread crashes when the size of the stack is too small. Maybe there should be some built in range-check for the stack in Oberon. (possible?) Do you see a solution for C) ? Felix. -- Felix Friedrich Institut für Biomathematik und Biometrie GSF - Forschungszentrum für Umwelt und Gesundheit, GmbH Ingolstädter Landstraße 1, D-85764 Neuherberg Tel: ++49 89 3187 2436 email: friedrich@gsf.de --
Felix Friedrich wrote:
Hi Patrick
However, in several years of working with Oberon, I have only found three ways to produce C-like system freezes apart from using the unsafe SYSTEM feature: A) calling C programs from within Oberon B) passing very large arrays as value parameters in procedure headings C) unloading modules whereby some visual gadget is still hanging around somewhere, as mentioned above. I feel system stability is a prominent one of the many highlights of Oberon, so the points B and C hurt the more...
I agree. By the way problem B) occurs because the max stacksize of an Oberon.Thread (in Windows) is approx. like 100kB. I have increased that value to 1MB in my threads, but anyway, the best "solution" is to take VAR-pars or Pointers. As far as I know, in Windows-Oberon it is a Windows-Problem, since the Windows-thread crashes when the size of the stack is too small. Maybe there should be some built in range-check for the stack in Oberon. (possible?) Do you see a solution for C) ?
I would think the simplest solution would be to tie a visual gadget to the module that created it. Freeing of that module could then not occur as long as an instance of the gadget occured anywhere. Its been a while since I looked at how gadgets are implemented and am a little surprised by this thread. Every visual instance should have a pointer associated with it and hence memory allocated. Kill the visual instance=> kill the pointer (mark it for garbage collection) and kill the pointer=>kill (remove) the visual instance. Why isn't this done? -Doug
participants (3)
-
Douglas G. Danforth -
Felix Friedrich -
Patrick, Dr. med. Hunziker