Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 3 participants
- 144635 messages
Re: [Pharo-dev] [ANN] General WebBrowser package for Pharo4 and Pharo 5 onwards
by Udo Schneider
That's really helpful! I'm just curious whether this might simplify
OAUth authentication even more. No need to copy a URL from Pharo to a
Browser - simply open the browser to the correct URL automatically.
CU,
Udo
On 13/04/16 10:11, Torsten Bergmann wrote:
> Hi,
>
> Some of you may know or use "ExternalWebbrowser" (maintained in the past by me, started back in the times right after Squeak and
> based on FFI), also there was an "ExternalWebbrowser2" fork from Sean later. First project got outdated with transition to NB,
> the second one stopped working for Pharo 5 due to the transition from NativeBoost (NB) to Universal Foreign Function Interface (UFFI).
>
> Two projects and now the broken code created a little bit a mess again in finding an easy way in opening an external webbrowser
> from Pharo. Updating my "ExternalWebbrowser" would easily bring confusion to newbies who thing "ExternalWebbrowser2"
> is newer. Having a an "ExternalWebbrowser3" would be silly too.
>
> So I decided to fix all this by providing a general "WebBrowser" package which now should solve the issue of easily opening an
> external webbrowser once and for all for primary platforms (Unix/Mac/Windows). The simple design allows to add also other
> platforms later if necessary.
>
> I based it for Pharo 4 on NB and Pharo 5 onwards on the new UFFI - so YES you can use it in both Pharo versions uniformely and
> the same way - which should simplify things now again.
>
>
> # Project page/Repository
>
> http://www.smalltalkhub.com/#!/~TorstenBergmann/WebBrowser
>
> # Description
>
> General and platform independent WebBrowser access for Pharo 4.0 onwards based on NativeBoost,
> for Pharo 5.0 onwards based on UFFI
>
> - Mac
> - Unix (Linux flavours)
> - Windows
>
> # Usage
>
> WebBrowser openOn: 'http://www.pharo.org'
>
> # Installation
>
> You can load it either from Configuration Browser (Pharo 4), Catalog/directly by typing "WebBrowser" into Spotter (Pharo 5 onwards)
> or with the following load expression:
>
> Metacello new
> smalltalkhubUser: 'TorstenBergmann' project: 'WebBrowser';
> configuration: 'WebBrowser';
> load
>
> # Other
>
> If you want to reference it in own configs note that version 0.1.0 is for Pharo 4 while 0.2.0 and following is for Pharo 5 onwards.
>
> Bye
> T.
>
>
April 13, 2016
Re: [Pharo-dev] NewExternalWebBrowser in Pharo 5
by Torsten Bergmann
Someone? ;)
I guess this should now fix the situation for Pharo4 AND Pharo 5:
http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2016-April/12072…
http://www.smalltalkhub.com/#!/~TorstenBergmann/WebBrowser
Have fun
T.
Â
Â
Gesendet:Â Mittwoch, 13. April 2016 um 08:29 Uhr
Von:Â "Max Leske" <maxleske(a)gmail.com>
An:Â "Pharo Development List" <pharo-dev(a)lists.pharo.org>
Betreff:Â Re: [Pharo-dev] NewExternalWebBrowser in Pharo 5
NativeBoost is no more. Someone will need to port it to UFFI.
Â
On 12 Apr 2016, at 20:00, jannik laval <jannik.laval(a)gmail.com> wrote:Â
Hi pharoers,
Â
I tried to load NewExternalWebBrowser.
Â
There are some issues when loading (in Transcript):
MacOSXPlatform>>open: (NBMacShell is Undeclared)Â
Win32Platform>>open: (NBWin32Shell is Undeclared)Â
NBUnixShell class>>run: (NativeBoost is Undeclared)Â
Loaded -> NewExternalWebBrowser-SeanDeNigris.3 ---Â http://smalltalkhub.com/mc/SeanDeNigris/SeansPlayground/main/[http://smallt… --- cache
Â
Â
Can someone help me ?
Cheers,
 --
~~Jannik Laval~~
Enseignant-chercheur
Responsable Pédagogique Licence Coordonnateur de Projet en Système d'Information
IUT Lumière, Université Lyon Lumière
laboratoire DISP
http://www.jannik-laval.eu[http://www.jannik-laval.eu/]
http://www.phratch.com[http://www.phratch.com/]
http://www.approchealpes.info[http://www.approchealpes.info/]
April 13, 2016
[ANN] General WebBrowser package for Pharo4 and Pharo 5 onwards
by Torsten Bergmann
Hi,
Some of you may know or use "ExternalWebbrowser" (maintained in the past by me, started back in the times right after Squeak and
based on FFI), also there was an "ExternalWebbrowser2" fork from Sean later. First project got outdated with transition to NB,
the second one stopped working for Pharo 5 due to the transition from NativeBoost (NB) to Universal Foreign Function Interface (UFFI).
Two projects and now the broken code created a little bit a mess again in finding an easy way in opening an external webbrowser
from Pharo. Updating my "ExternalWebbrowser" would easily bring confusion to newbies who thing "ExternalWebbrowser2"
is newer. Having a an "ExternalWebbrowser3" would be silly too.
So I decided to fix all this by providing a general "WebBrowser" package which now should solve the issue of easily opening an
external webbrowser once and for all for primary platforms (Unix/Mac/Windows). The simple design allows to add also other
platforms later if necessary.
I based it for Pharo 4 on NB and Pharo 5 onwards on the new UFFI - so YES you can use it in both Pharo versions uniformely and
the same way - which should simplify things now again.
# Project page/Repository
http://www.smalltalkhub.com/#!/~TorstenBergmann/WebBrowser
# Description
General and platform independent WebBrowser access for Pharo 4.0 onwards based on NativeBoost,
for Pharo 5.0 onwards based on UFFI
- Mac
- Unix (Linux flavours)
- Windows
# Usage
WebBrowser openOn: 'http://www.pharo.org'
# Installation
You can load it either from Configuration Browser (Pharo 4), Catalog/directly by typing "WebBrowser" into Spotter (Pharo 5 onwards)
or with the following load expression:
Metacello new
smalltalkhubUser: 'TorstenBergmann' project: 'WebBrowser';
configuration: 'WebBrowser';
load
# Other
If you want to reference it in own configs note that version 0.1.0 is for Pharo 4 while 0.2.0 and following is for Pharo 5 onwards.
Bye
T.
April 13, 2016
Re: [Pharo-dev] NewExternalWebBrowser in Pharo 5
by Max Leske
> On 13 Apr 2016, at 09:00, Stephan Eggermont <stephan(a)stack.nl> wrote:
>
> On 13-04-16 08:29, Max Leske wrote:
>> NativeBoost is no more. Someone will need to port it to UFFI.
>>
> Uhm, isn't this what Torsten's OS-... are about?
> Should just be a dependency and a different call?
Very much possible. I didnât follow that thread.
>
> Stephan
>
>
April 13, 2016
Re: [Pharo-dev] NewExternalWebBrowser in Pharo 5
by Stephan Eggermont
On 13-04-16 08:29, Max Leske wrote:
> NativeBoost is no more. Someone will need to port it to UFFI.
>
Uhm, isn't this what Torsten's OS-... are about?
Should just be a dependency and a different call?
Stephan
April 13, 2016
Re: [Pharo-dev] NewExternalWebBrowser in Pharo 5
by Max Leske
NativeBoost is no more. Someone will need to port it to UFFI.
> On 12 Apr 2016, at 20:00, jannik laval <jannik.laval(a)gmail.com> wrote:
>
> Hi pharoers,
>
> I tried to load NewExternalWebBrowser.
>
> There are some issues when loading (in Transcript):
> MacOSXPlatform>>open: (NBMacShell is Undeclared)
> Win32Platform>>open: (NBWin32Shell is Undeclared)
> NBUnixShell class>>run: (NativeBoost is Undeclared)
> Loaded -> NewExternalWebBrowser-SeanDeNigris.3 --- http://smalltalkhub.com/mc/SeanDeNigris/SeansPlayground/main/ <http://smalltalkhub.com/mc/SeanDeNigris/SeansPlayground/main/> --- cache
>
>
> Can someone help me ?
> Cheers,
>
> --
> ~~Jannik Laval~~
> Enseignant-chercheur
> Responsable Pédagogique Licence Coordonnateur de Projet en Système d'Information
> IUT Lumière, Université Lyon Lumière
> laboratoire DISP
> http://www.jannik-laval.eu <http://www.jannik-laval.eu/>
> http://www.phratch.com <http://www.phratch.com/>
> http://www.approchealpes.info <http://www.approchealpes.info/>
April 13, 2016
Re: [Pharo-dev] [Vm-dev] Re: [squeak-dev] Re: A weak/leak story
by Eliot Miranda
On Tue, Apr 12, 2016 at 6:46 AM, Levente Uzonyi <leves(a)caesar.elte.hu>
wrote:
>
> Hi Eliot,
>
> I think the only interesting question is: can I create an ephemeron in a
> Spur image?
> If yes, then weak collections can be significanly improved. If the answer
> is no, then the difference made by individual weak collection finalization
> will be insignificant for most users, since there are usually less than
> four WeakRegistries in an image, while other weak collections don't rely on
> the finalizationProcess. (One might get the impression that
> WeakKeyDictionary does, but that won't work as one might think unless the
> dictionary is the internal collection of a WeakRegistry.)
> Of course, the above only applies to Squeak.
>
The answer is yes. Find attached an Ephemeron definition (but with no
methods) and the new finalisation scheme. To use the scheme one must
evaluate Smalltalk supportsQueueingFinalization: true. Ephemeron needs a
suitable mourn method, which would send finalise to its key, but also
remove the ephemeron from whatever registry we keep ephemerons in.
As I say, though, the first order of business is to find out why turning on
the scheme causes file access to fail very soon after.
> Levente
>
> On Tue, 12 Apr 2016, Eliot Miranda wrote:
>
> Hi Guille,
>>
>> On Apr 12, 2016, at 2:41 AM, Guille Polito <guillermopolito(a)gmail.com>
>> wrote:
>>
>> Hi list,
>>
>> With Pavel and Christophe we spend some time digging these last
>> weaks chasing the memory leaks we were seeing lately. It is a long
>> story to tell, so this mail is divided in three:
>>
>> 1) A brief intro to weak structures and finalization in Pharo, for
>> those that do not know,
>> 2) A bit of history to explain what happened in pre-spur and
>> post-spur,
>> 3) The actual cause of the memory leak today,
>> 4) How to avoid them in your application, and what are we going to
>> do to prevent this in the future.
>>
>>
>> forgive me for not responding with code immediately. Proper
>> Ephemeron support is already in the Spur VM, plus a "proper" finalization
>> queue,
>> which allows us to drop the weak registries, which have a scaling
>> problem. The proper Ephemeron support required ClassBuilder changes. I can
>> provide Squeak code soon, but not until the end of the week; Clément and
>> I have two presentations to prepare today and tomorrow, and it's 4am...
>>
>> Replacing the weak registry with the proper finalization queue, in which
>> appears both triggered ephemerons and weak collections that have lost
>> references, means that individual ephemerons and weak collections can
>> mourn, instead of the system having to scan all weak collections in all weak
>> registries whenever a single weak collection loses a referent.
>>
>> My own Ephemeron story is that when I tried to replace the weak registry
>> with the proper finalization queue in Squeak last year the mysterious
>> symptom I had was the system running out of file descriptors and source
>> file access stopping working. I haven't had time (or a collaborator of
>> two) to dig further. So if there is a brave soul or two interested in
>> getting ephemerons released and tested I'd love to get in touch and get
>> this done. We need ephemerons and I expect we want a scalable weak
>> mourning scheme.
>>
>> _,,,^..^,,,_ (phone)
>>
>> For those that need/want/prefer just the practical explanation, you
>> can jump over 2) and just read 1) and 3).
>>
>>
>> ========================================================================
>> 1. A weak explanation
>>
>> ========================================================================
>>
>> To cleanup objects upon garbage collection, Pharo and Squeak use a
>> finalization mechanism based on a Weak Registry. That is, if you
>> want to execute some cleanup (like closing a file) when an object
>> is about to be collected, you have to put your object inside the
>> weak registry with the corresponding executor/finalizer object. The
>> object you want to 'track' is hold weakly by this weak registry
>> i.e., if the only reference to the object is from the weak
>> registry, it will be chosen for garbage collection. When this object is
>> collected, a special process in the Pharo image will send #finalize
>> to your executor object where you implement your cleanup.
>>
>> To interact with the weak registry, there are two main subscription
>> messages:
>>
>> - #add:executor:
>>
>> Will add an object to the registry with the executor that is send
>> as argument.
>>
>> - #add:
>>
>> Will add an object to the registry, and use as executor a
>> 'shallow copy' of the object.
>>
>> Some conclusions to be made from this:
>> 1) If the executor points strongly to the object that we want to
>> collect, it will never be collected. That is why the #add: message
>> creates a copy of the object.
>> 2) If we do not provide an explicit executor, the registered
>> object should already contain all information required for the
>> finalization (like file handlers or external pointers). If not, the
>> shallow copy will not be able to finalize correctly.
>>
>> Also:
>> - Using weak objects/references do not guarantee that #finalize
>> will be called, you need to put your object inside the registry!
>> - Using weak objects/references do not guarantee that your object
>> will be magically collected. You can still cause memory leaks!
>>
>>
>> ========================================================================
>> 2. A weak story
>>
>> ========================================================================
>>
>> Pharo and Squeak use historically the weak registry mentioned
>> above. Because of the limitations that we mentioned, a different kind of
>> weak structure called Ephemerons is required/more useful. To
>> overcome some of these limitations, Igor (Hi Igor! maybe you're reading
>> :)) implemented a couple of years ago a new finalization mechanism
>> that, IIANM, worked as follows:
>>
>> - Some weak objects could have a first instance variable with a
>> special linked list
>> - When the object was about to be collected, instead it was removed
>> from the weak structure and put into its container's linked list
>> - On the image side, a special process iterated all special linked
>> lists and executed #finalize on the weak objects
>>
>> This mechanism was called NewFinalization, in contrast with what
>> was called LegacyFinalization. Of course these names are context
>> dependent, since today's Pharo is back to the so called legacy one
>> ;). NewFinalization was implemented as the default finalization
>> mechanim in Pharo, both in VM and image side. But the VM changes
>> remained in the Pharo branch of development. After some discussions,
>> I remember Igor and Eliot agreed that what they actually needed
>> were Ephemerons, and since Eliot had started working on Spur at that
>> time, he said he would provide Ephemeric classes with the new
>> object format.
>>
>> Basically, for those interested, an ephemeron is an association
>>
>> weak key -> strong value
>>
>> with the special quality that upon garbage collection all
>> references to the weak key that are computed from the strong value (directly
>> or indirectly) are taken as weak. This allows the collection of the
>> weak key even if the strong value points to it, but requires some
>> more machinery in the GC/VM. You can read more in here [1].
>>
>> Until a couple of months/weeks ago, Pharo was using the
>> NewFinalization mechanism with it's special image and VM support. And Squeak
>> was using the 'Legacy' one. And then Spur arrived.
>>
>> So Spur arrived, and Eliot and Esteban made a lot of effort to
>> simplify the VM's maintenance, and they merged both branches. As a
>> conclusion, Pharo Spur VM did not support any more NewFinalization.
>> This provoked at first some leaks because objects were not being
>> finalized. A couple of weeks ago, we migrated back the image code
>> to use the 'Legacy' mechanism, see issue 17537 [2].
>>
>> And then finalization was not working either. Nor #finalize was
>> being called on executors, nor objects in the weak registry were
>> collected. As a symptom, opening any tool will cause 30 new
>> everlasting registrations into the weakregistry, and no tools were
>> collected.
>>
>>
>>
>> ========================================================================
>> 3. The cause
>>
>> ========================================================================
>>
>> After lots of digging, we finally found what was the particular
>> issue causing objects in the weak registry to not be collected. In
>> some words, it is caused by the normal belief that "weak objects
>> are magical", which caused that weak references and finalizers are
>> really spread over the system with no proper care. And particularly
>> related to the usage of announcements.
>>
>> To explain better, I made some pictures for you :)
>>
>>
>> ***First, imagine you have a morph with its own local announcer.
>> You subscribe to two events, and the graph will look like this.
>>
>> <strong.png>
>>
>> - the announcer knows two strong subscriptions
>> - the subscriptions know the announcer to be able to unregister
>> - the subscriptions know the registered object to send the message
>> in case the event happens
>>
>> This forms a closed graph that will be collected. No problem so far.
>>
>>
>> ***Second, let's see what happens if we use weak subsriptions:
>>
>> <weak.png>
>>
>> - the announcer know two weak subscriptions
>> - these weak subscriptions know the announcer strongly to be able
>> to unregister
>> - they also know the subscriber object but weakly
>> - THE difference is made by the weak registry: a global object that
>> manages when and how objects are finalized. In the case of
>> announcers, the weak registry will store weakly the subscriber
>> morph, and strongly the weak announcer subscription.
>>
>> So far so good also: the references to the morph are weak. When the
>> morph is collected, the weak registry will execute finalize on the
>> announcement subscriptions. The subscriptions will unregister from
>> the morph.
>>
>>
>> ***The really problematic case is the third one: mixing weak and
>> strong subscriptions in the same announcer.
>>
>> <both.png>
>>
>> The object graph is just a mixture of the two other ones. One weak
>> subscription and one strong subscription. BUT:
>>
>> - there is a strong path from a global object (the weak registry)
>> to the subscriber (the morph)
>> - then the morph is never collected
>> - the weak registry never finalizes the weak announcement
>> subscription
>> - the graph remains there forever.
>>
>>
>> And these are the simple cases that show the problem. Imagine that
>> you can have this same configuration but in cycles/chains among
>> different morphs/announcements. Plus this is aggravated by evil
>> globals (e.g., the theme and the HandMorph remembers the last focused
>> morph, the system window class remembers the last top window even
>> if it was closed...).
>>
>>
>>
>> ========================================================================
>> 4. The solution?
>>
>> ========================================================================
>>
>> Our solution for the moment is simple. We would like to enforce the
>> following two rules for announcements:
>>
>> - announcers local to a morph should only be used strongly. YES,
>> this may cause small hiccups and leaks, for example if you register a
>> morph A to the announcer to another morph B. But in the long term,
>> these two will form a closed graph and will be collected.
>>
>> - announcers used globally, such as the System announcer, should be
>> used only and uniquely in a weak manner. Like that we ensure that
>> they are loosely coupled for real.
>>
>> So, please, please, do not use weak announcements unless you're
>> really sure of what you're doing. At least, until we have ephemerons
>> and we are sure everything works as expected. Ephemerons would
>> solve this in a more natural way: if we model the weak registry
>> subscription as an ephemeron, any reference to the weak #key that
>> arrives from the #value will be treated as weak also.
>>
>> Other action points we are working on:
>> - fixing tools to follow the rules above
>> - We are also writing tests to check that tools (gt*, Nautilus,
>> Rubric, FT) do not leak.
>> - chasing other small memory leaks created by stepping, focus
>> global variables...
>>
>>
>> ((fogbugz allIssues select: [ :each | each relatedToLeak ])
>> flatCollect: [ :each | each participants ])
>> do: #thanks
>>
>>
>>
>> [1] https://en.wikipedia.org/wiki/Ephemeron
>> [2]
>> https://pharo.fogbugz.com/f/cases/17537/SystemAnnouncer-has-far-too-many-su…
>>
>
_,,,^..^,,,_
best, Eliot
April 13, 2016
NewExternalWebBrowser in Pharo 5
by jannik laval
Hi pharoers,
I tried to load NewExternalWebBrowser.
There are some issues when loading (in Transcript):
MacOSXPlatform>>open: (NBMacShell is Undeclared)
Win32Platform>>open: (NBWin32Shell is Undeclared)
NBUnixShell class>>run: (NativeBoost is Undeclared)
Loaded -> NewExternalWebBrowser-SeanDeNigris.3 ---
http://smalltalkhub.com/mc/SeanDeNigris/SeansPlayground/main/ --- cache
Can someone help me ?
Cheers,
--
~~Jannik Laval~~
Enseignant-chercheur
Responsable Pédagogique Licence Coordonnateur de Projet en Système
d'Information
IUT Lumière, Université Lyon Lumière
laboratoire DISP
http://www.jannik-laval.eu
http://www.phratch.com
http://www.approchealpes.info
April 12, 2016
Re: [Pharo-dev] A weak/leak story
by stepharo
Super cool mail!
Thanks for the time you spent to write it.
I will publish it on pharo weekly.
Stef
Le 12/4/16 11:41, Guille Polito a écrit :
> Hi list,
>
> With Pavel and Christophe we spend some time digging these last weaks
> chasing the memory leaks we were seeing lately. It is a long story to
> tell, so this mail is divided in three:
>
> 1) A brief intro to weak structures and finalization in Pharo, for
> those that do not know,
> 2) A bit of history to explain what happened in pre-spur and post-spur,
> 3) The actual cause of the memory leak today,
> 4) How to avoid them in your application, and what are we going to do
> to prevent this in the future.
>
> For those that need/want/prefer just the practical explanation, you
> can jump over 2) and just read 1) and 3).
>
> ========================================================================
> 1. A weak explanation
> ========================================================================
>
> To cleanup objects upon garbage collection, Pharo and Squeak use a
> finalization mechanism based on a Weak Registry. That is, if you want
> to execute some cleanup (like closing a file) when an object is about
> to be collected, you have to put your object inside the weak registry
> with the corresponding executor/finalizer object. The object you want
> to 'track' is hold weakly by this weak registry i.e., if the only
> reference to the object is from the weak registry, it will be chosen
> for garbage collection. When this object is collected, a special
> process in the Pharo image will send #finalize to your executor object
> where you implement your cleanup.
>
> To interact with the weak registry, there are two main subscription
> messages:
>
> - #add:executor:
>
> Will add an object to the registry with the executor that is send as
> argument.
>
> - #add:
>
> Will add an object to the registry, and use as executor a 'shallow
> copy' of the object.
>
> Some conclusions to be made from this:
> 1) If the executor points strongly to the object that we want to
> collect, it will never be collected. That is why the #add: message
> creates a copy of the object.
> 2) If we do not provide an explicit executor, the registered object
> should already contain all information required for the finalization
> (like file handlers or external pointers). If not, the shallow copy
> will not be able to finalize correctly.
>
> Also:
> - Using weak objects/references do not guarantee that #finalize will
> be called, you need to put your object inside the registry!
> - Using weak objects/references do not guarantee that your object
> will be magically collected. You can still cause memory leaks!
>
> ========================================================================
> 2. A weak story
> ========================================================================
>
> Pharo and Squeak use historically the weak registry mentioned above.
> Because of the limitations that we mentioned, a different kind of weak
> structure called Ephemerons is required/more useful. To overcome some
> of these limitations, Igor (Hi Igor! maybe you're reading :))
> implemented a couple of years ago a new finalization mechanism that,
> IIANM, worked as follows:
>
> - Some weak objects could have a first instance variable with a
> special linked list
> - When the object was about to be collected, instead it was removed
> from the weak structure and put into its container's linked list
> - On the image side, a special process iterated all special linked
> lists and executed #finalize on the weak objects
>
> This mechanism was called NewFinalization, in contrast with what was
> called LegacyFinalization. Of course these names are context
> dependent, since today's Pharo is back to the so called legacy one ;).
> NewFinalization was implemented as the default finalization mechanim
> in Pharo, both in VM and image side. But the VM changes remained in
> the Pharo branch of development. After some discussions, I remember
> Igor and Eliot agreed that what they actually needed were Ephemerons,
> and since Eliot had started working on Spur at that time, he said he
> would provide Ephemeric classes with the new object format.
>
> Basically, for those interested, an ephemeron is an association
>
> weak key -> strong value
>
> with the special quality that upon garbage collection all references
> to the weak key that are computed from the strong value (directly or
> indirectly) are taken as weak. This allows the collection of the weak
> key even if the strong value points to it, but requires some more
> machinery in the GC/VM. You can read more in here [1].
>
> Until a couple of months/weeks ago, Pharo was using the
> NewFinalization mechanism with it's special image and VM support. And
> Squeak was using the 'Legacy' one. And then Spur arrived.
>
> So Spur arrived, and Eliot and Esteban made a lot of effort to
> simplify the VM's maintenance, and they merged both branches. As a
> conclusion, Pharo Spur VM did not support any more NewFinalization.
> This provoked at first some leaks because objects were not being
> finalized. A couple of weeks ago, we migrated back the image code to
> use the 'Legacy' mechanism, see issue 17537 [2].
>
> And then finalization was not working either. Nor #finalize was being
> called on executors, nor objects in the weak registry were collected.
> As a symptom, opening any tool will cause 30 new everlasting
> registrations into the weakregistry, and no tools were collected.
>
>
> ========================================================================
> 3. The cause
> ========================================================================
>
> After lots of digging, we finally found what was the particular issue
> causing objects in the weak registry to not be collected. In some
> words, it is caused by the normal belief that "weak objects are
> magical", which caused that weak references and finalizers are really
> spread over the system with no proper care. And particularly related
> to the usage of announcements.
>
> To explain better, I made some pictures for you :)
>
>
> ***First, imagine you have a morph with its own local announcer. You
> subscribe to two events, and the graph will look like this.
>
> strong-graph
>
> - the announcer knows two strong subscriptions
> - the subscriptions know the announcer to be able to unregister
> - the subscriptions know the registered object to send the message in
> case the event happens
>
> This forms a closed graph that will be collected. No problem so far.
>
>
> ***Second, let's see what happens if we use weak subsriptions:
>
>
>
> - the announcer know two weak subscriptions
> - these weak subscriptions know the announcer strongly to be able to
> unregister
> - they also know the subscriber object but weakly
> - THE difference is made by the weak registry: a global object that
> manages when and how objects are finalized. In the case of announcers,
> the weak registry will store weakly the subscriber morph, and strongly
> the weak announcer subscription.
>
> So far so good also: the references to the morph are weak. When the
> morph is collected, the weak registry will execute finalize on the
> announcement subscriptions. The subscriptions will unregister from the
> morph.
>
>
> ***The really problematic case is the third one: mixing weak and
> strong subscriptions in the same announcer.
>
>
>
> The object graph is just a mixture of the two other ones. One weak
> subscription and one strong subscription. BUT:
>
> - there is a strong path from a global object (the weak registry) to
> the subscriber (the morph)
> - then the morph is never collected
> - the weak registry never finalizes the weak announcement subscription
> - the graph remains there forever.
>
>
> And these are the simple cases that show the problem. Imagine that you
> can have this same configuration but in cycles/chains among different
> morphs/announcements. Plus this is aggravated by evil globals (e.g.,
> the theme and the HandMorph remembers the last focused morph, the
> system window class remembers the last top window even if it was
> closed...).
>
>
> ========================================================================
> 4. The solution?
> ========================================================================
>
> Our solution for the moment is simple. We would like to enforce the
> following two rules for announcements:
>
> - announcers local to a morph should only be used strongly. YES, this
> may cause small hiccups and leaks, for example if you register a morph
> A to the announcer to another morph B. But in the long term, these two
> will form a closed graph and will be collected.
>
> - announcers used globally, such as the System announcer, should be
> used only and uniquely in a weak manner. Like that we ensure that they
> are loosely coupled for real.
>
> So, please, please, do not use weak announcements unless you're really
> sure of what you're doing. At least, until we have ephemerons and we
> are sure everything works as expected. Ephemerons would solve this in
> a more natural way: if we model the weak registry subscription as an
> ephemeron, any reference to the weak #key that arrives from the #value
> will be treated as weak also.
>
> Other action points we are working on:
> - fixing tools to follow the rules above
> - We are also writing tests to check that tools (gt*, Nautilus,
> Rubric, FT) do not leak.
> - chasing other small memory leaks created by stepping, focus global
> variables...
>
>
> ((fogbugz allIssues select: [ :each | each relatedToLeak ])
> flatCollect: [ :each | each participants ])
> do: #thanks
>
>
>
> [1] https://en.wikipedia.org/wiki/Ephemeron
> [2]
> https://pharo.fogbugz.com/f/cases/17537/SystemAnnouncer-has-far-too-many-su…
April 12, 2016
Re: [Pharo-dev] new pharo cheatsheet
by stepharo
Hi eliot
I took everything into account except the
Personally I very much /would/ include ". statement separator" in the reserved syntactic constructs table. I might try and split the table into "syntax" ( "comment" ; . and ^ ) and "object constructors" tables (everything else).
I have to digest it and now I should finish some other work for the mooc.
I'm fighting a lot with the space :)
Stef
Le 12/4/16 13:35, Eliot Miranda a écrit :
> In the "common constructs" conditionals and iterations tables, the Java appears on the left and the Smalltalk on the right. In other tables the Smalltalk occurs on the left and the explanation appears on the right. Hence, in the conditionals and iterations tables, put the Java on the right.
>
> Personally I very much /would/ include ". statement separator" in the reserved syntactic constructs table. I might try and split the table into "syntax" ( "comment" ; . and ^ ) and "object constructors" tables (everything else).
>
> _,,,^..^,,,_ (phone)
>
>> On Apr 11, 2016, at 11:58 PM, stepharo <stepharo(a)free.fr> wrote:
>>
>> new syntaxsheet
>>
>>
>> <pharoCheatSheet.pdf>
>
April 12, 2016