Garbage collector issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Garbage collector issue

Pavel Krivanek-3
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel




script2.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Garbage collector issue

Clément Béra
 
Is it the same behavior in Pharo 3 ? 

Just wondering if this is a Spur issue or if it is non related to Spur. 

On Thu, Jan 26, 2017 at 2:38 PM, Pavel Krivanek <[hidden email]> wrote:
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel





Reply | Threaded
Open this post in threaded view
|

Re: Garbage collector issue

Pavel Krivanek-3
 
Strange, in Pharo 3 it behaves the same way. So probably not directly Spur related.

-- Pavel

2017-01-26 14:52 GMT+01:00 Clément Bera <[hidden email]>:
 
Is it the same behavior in Pharo 3 ? 

Just wondering if this is a Spur issue or if it is non related to Spur. 

On Thu, Jan 26, 2017 at 2:38 PM, Pavel Krivanek <[hidden email]> wrote:
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel







Reply | Threaded
Open this post in threaded view
|

Re: Garbage collector issue

Pavel Krivanek-3
 
Taking back.

I tried it in older versions up to Squeak 3.9. It behaves the same way with the script I sent but it is not good way how to show it. Because in older versions if you disable explicit garbageCollect after every 100 cycles, the number of objects is decreased spontaneously after a while.
But on the current VM it grows continuously.

-- Pavel

2017-01-26 14:58 GMT+01:00 Pavel Krivanek <[hidden email]>:
Strange, in Pharo 3 it behaves the same way. So probably not directly Spur related.

-- Pavel

2017-01-26 14:52 GMT+01:00 Clément Bera <[hidden email]>:
 
Is it the same behavior in Pharo 3 ? 

Just wondering if this is a Spur issue or if it is non related to Spur. 

On Thu, Jan 26, 2017 at 2:38 PM, Pavel Krivanek <[hidden email]> wrote:
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel









script4.st (944 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Garbage collector issue

Bert Freudenberg
In reply to this post by Pavel Krivanek-3
 
What exactly is the behavior in Pharo?

In a recent Squeak on Spur I don't see anything unusual. In my image there are 9 Object instances. Then I added the "Object basicNew" in #checkForNewScreenSize and the instance count of Object starts increasing rapidly until the next incremental GC, which happens about every 10 seconds, then the count drops and starts increasing again.

I verified it like this:

(UpdatingStringMorph on: Object selector: #instanceCount) openInHand

... which continuously shows the number of instances, and

(UpdatingStringMorph on: [Smalltalk vmParameterAt: 9] selector: #value) openInHand

... which shows the number of incremental GCs.

Is it possible that in your image there is so little garbage generated that no incremental GC is triggered for a long time? My image has dozens of windows and stepping morphs. I'd try to log vm param 9 along with your inst count.


- Bert -

On Thu, Jan 26, 2017 at 2:58 PM, Pavel Krivanek <[hidden email]> wrote:
 
Strange, in Pharo 3 it behaves the same way. So probably not directly Spur related.

-- Pavel

2017-01-26 14:52 GMT+01:00 Clément Bera <[hidden email]>:
 
Is it the same behavior in Pharo 3 ? 

Just wondering if this is a Spur issue or if it is non related to Spur. 

On Thu, Jan 26, 2017 at 2:38 PM, Pavel Krivanek <[hidden email]> wrote:
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel









Reply | Threaded
Open this post in threaded view
|

Re: Garbage collector issue

Pavel Krivanek-3
 
Well, 

I tried it again on Squeak an Pharo and objects are garbage collected after about 90 seconds on Pharo, on Squeak sooner. So probably only a false alarm, sorry. I'll do some next checks.

-- Pavel

2017-01-26 15:28 GMT+01:00 Bert Freudenberg <[hidden email]>:
 
What exactly is the behavior in Pharo?

In a recent Squeak on Spur I don't see anything unusual. In my image there are 9 Object instances. Then I added the "Object basicNew" in #checkForNewScreenSize and the instance count of Object starts increasing rapidly until the next incremental GC, which happens about every 10 seconds, then the count drops and starts increasing again.

I verified it like this:

(UpdatingStringMorph on: Object selector: #instanceCount) openInHand

... which continuously shows the number of instances, and

(UpdatingStringMorph on: [Smalltalk vmParameterAt: 9] selector: #value) openInHand

... which shows the number of incremental GCs.

Is it possible that in your image there is so little garbage generated that no incremental GC is triggered for a long time? My image has dozens of windows and stepping morphs. I'd try to log vm param 9 along with your inst count.


- Bert -

On Thu, Jan 26, 2017 at 2:58 PM, Pavel Krivanek <[hidden email]> wrote:
 
Strange, in Pharo 3 it behaves the same way. So probably not directly Spur related.

-- Pavel

2017-01-26 14:52 GMT+01:00 Clément Bera <[hidden email]>:
 
Is it the same behavior in Pharo 3 ? 

Just wondering if this is a Spur issue or if it is non related to Spur. 

On Thu, Jan 26, 2017 at 2:38 PM, Pavel Krivanek <[hidden email]> wrote:
 
Hi,

in Pharo and in Squeak, if you try to print:

Point allInstances size.

several times, you will get fastly growing number of Point instances in most cases. But when you do:

Smalltalk garbageCollect. Point allInstances size.

The number of instances is quite stable.

I realized that about every 5 milliseconds two new Point instances are created and not collected in reasonable time. I tried to find what points to them and I realized that nothing. That two instances contain display size so it was easy to find the place where these points are created. In Pharo it is in

MorphicUIManager>>#checkForNewDisplaySize

"Check whether the screen size has changed and if so take appropriate actions"

Display extent = DisplayScreen actualScreenSize ifTrue: [^ Display].
DisplayScreen startUp.
World restoreMorphicDisplay.

As you can see in the code, the two point instances are only very temporary objects. And with some experiments I realized that that behavior is not Point specific (eg. some problem with the @ primitive). Because if you replace the code of the method with only Object basicNew, the growth of Object instances is similar. See the attached script.

pharo-ui Pharo st script2.st

Cheers,
-- Pavel