Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WAMemory on Pharo #1339

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"classes are in the global pool, ignore counting them"
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Behavior"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"booleans are singletons, ignore counting them"
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Boolean"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"blocks can be stored in collections and instance variables
Report but don't intropect them. This may miss reporting catured variables."
aMemory accumulate: self.
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "CompiledBlock"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"methods are stored in classes, ignore counting them"
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "CompiledMethod"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"we only have two instance variables:
- sender which we ignore because will always get niled out when the stack unwound so won't be captured but this will not have happened yet for contexts involved in the current request
- pc with is a SmallInteger and therefore immediate"
aMemory accumulate: self.
anIdentitySet add: self

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
aMemory accumulate: self.
| traversableInstVarIndexes traversableIndexableVarIndexes |
anIdentitySet add: self.
self traversableInstVarIndexes do: [ :index |
self isImmediateObject ifTrue: [
"don't report immediates"
^ self ].
aMemory accumulate: self.
traversableInstVarIndexes := self class instSize.
1 to: traversableInstVarIndexes do: [ :index |
aMemory
traverse: self
value: (self instVarAt: index)
seen: anIdentitySet ].
self traversableIndexableVarIndexes do: [ :index |
traversableIndexableVarIndexes := self basicSize.
1 to: traversableIndexableVarIndexes do: [ :index |
aMemory
traverse: self
value: (self basicAt: index)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"Process is excluded because otherwise our Semaphores pull them in and the Process is
obviously not held onto by the Semaphore indefinitely."
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Process"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"symbol are in the global table, ignore counting them"
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Symbol"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-Pharo-Development
traverseWithMemory: aMemory seen: anIdentitySet
"nil is global, ignore counting it"
anIdentitySet add: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "UndefinedObject"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
private
buildTable
^ WATableReport new
rows: instances values;
columns: (Array
with: (WAReportColumn new
| classColumn instanceCountColumn totalSizeColumn |
classColumn := WAReportColumn new
title: 'Class';
selector: #name;
sortBlock: [ :a :b | a < b ];
yourself)
with: (WAReportColumn new
yourself.
instanceCountColumn := WAReportColumn new
title: 'Instances';
selector: #count;
sortBlock: [ :a :b | a > b ];
cssClass: 'right';
hasTotal: true;
yourself)
with: (WAReportColumn new
yourself.
totalSizeColumn := WAReportColumn new
title: 'Total Size';
selector: #size;
sortBlock: [ :a :b | a > b ];
formatBlock: [ :each | formatter print: each ];
cssClass: 'right';
hasTotal: true;
yourself));
yourself.
^ WATableReport new
rows: instances values;
columns: (Array
with: classColumn
with: instanceCountColumn
with: totalSizeColumn);
sortColumn: totalSizeColumn;
yourself
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
private
traverse: anObject value: aValue seen: anIdentitySet
(aValue isNil or: [ aValue isLiteral or: [ aValue isBehavior or: [ (anIdentitySet includes: aValue) or: [ IgnoredClasses anySatisfy: [ :each | aValue isKindOf: each ] ] ] ] ])
(aValue isNil or: [ anIdentitySet includes: aValue ])
ifTrue: [ ^ self ].
aValue traverseWithMemory: self seen: anIdentitySet
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hooks
traverseWithMemory: aMemory seen: anIdentitySet
"don't report self"
anIdentitySet add: self
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"category" : "Seaside-Pharo-Development-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [
"IgnoredClasses"
],
"classvars" : [ ],
"instvars" : [
"instances",
"table",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hooks
traverseWithMemory: aMemory seen: anIdentitySet
"don't report self"
anIdentitySet add: self