7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
|
13 'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:10' ! |
|
14 |
12 |
15 Array subclass:#WeakArray |
13 Array subclass:#WeakArray |
16 instanceVariableNames:'dependents' |
14 instanceVariableNames:'dependents' |
17 classVariableNames:'RegistrationFailedSignal AlreadyInitialized' |
15 classVariableNames:'RegistrationFailedSignal AlreadyInitialized' |
18 poolDictionaries:'' |
16 poolDictionaries:'' |
69 Also, as a side effect, it is possible to delay finalization by blocking |
67 Also, as a side effect, it is possible to delay finalization by blocking |
70 interrupts. |
68 interrupts. |
71 |
69 |
72 A weakArray notifies its dependents via normal dependency notfications. |
70 A weakArray notifies its dependents via normal dependency notfications. |
73 |
71 |
74 NOTICE: |
72 [hint:] |
75 WeakArray handling adds some overhead to the VM |
73 WeakArray handling adds small some overhead to the VM |
76 (each weakarray is scanned after each GC). |
74 (each weakarray is scanned after each GC). |
77 It is uncertain, if the current mechanism works well |
75 It is uncertain, if the current mechanism works well |
78 with (say) ten-thousands of weakArrays. |
76 with (say) ten-thousands of weakArrays. |
79 |
77 We had the system running with >2000 weakArrays, some being quite |
|
78 big for a while and had a few percent of added gc time. |
|
79 The system as delivered creates between 50 and 100 weakArrays, |
|
80 but with many dependents, this number may grow. |
|
81 If you need the dependency mechanism on a huge number of objects, |
|
82 consider adding a (non-weak) dependents field to your class |
|
83 - take the implementation of Model as a guide (or subclass them |
|
84 from Model). |
|
85 |
|
86 \ |
80 As a possible option, we could perform the weakArray scanning only in |
87 As a possible option, we could perform the weakArray scanning only in |
81 the oldSpace reclamation code - this would remove most of the overhead, |
88 the oldSpace reclamation code - this would remove most of the overhead, |
82 but will lead to much longer delayed finalization .... we will see. |
89 but will lead to much longer delayed finalization .... we will see. |
83 |
90 |
84 |
91 |