[squeak-dev] The Trunk: KernelTests-eem.434.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Jun 10 23:31:08 UTC 2022
Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.434.mcz
==================== Summary ====================
Name: KernelTests-eem.434
Author: eem
Time: 10 June 2022, 4:31:06.625266 pm
UUID: d090335f-a9a4-4b0e-8316-5d8776dcf9d7
Ancestors: KernelTests-jar.433
Make the one gig allocation test sane. Rename the badly named setFreeSpaceLimitOf:around: to what it actually does (setMaximumOldSpaceTo:around:) and provide setMaximumOldSpaceToAtLeast:around: for those that want to start up the system setting a very large limit and test e.g. the OutOfMemory signal at greater heap sizes. Use setMaximumOldSpaceToAtLeast:around: in both testOneGigAllocation and testOutOfMemorySignal. Fix testOneGigAllocation to allocate approximately 1 GB, rather than a billion times the word size (4 or 8 Gb).
=============== Diff against KernelTests-jar.433 ===============
Item was removed:
- ----- Method: AllocationTest>>setFreeSpaceLimitOf:around: (in category 'support') -----
- setFreeSpaceLimitOf: bytes around: aBlock
- "Attempt to evaluate aBlock with a limit of the requested ammount
- of free old space, restoring the extant limit after the evaluation."
-
- | extantLimit |
- extantLimit := Smalltalk vmParameterAt: 67.
- Smalltalk vmParameterAt: 67 put: (Smalltalk vmParameterAt: 1) + bytes asInteger.
- ^aBlock ensure: [Smalltalk vmParameterAt: 67 put: extantLimit]!
Item was added:
+ ----- Method: AllocationTest>>setMaximumOldSpaceTo:around: (in category 'support') -----
+ setMaximumOldSpaceTo: bytes around: aBlock
+ "Attempt to evaluate aBlock with a limit of the requested maximum
+ size of old space, restoring the extant limit after the evaluation."
+
+ | extantLimit |
+ extantLimit := Smalltalk vmParameterAt: 67.
+ Smalltalk vmParameterAt: 67 put: (Smalltalk vmParameterAt: 1) + bytes asInteger.
+ ^aBlock ensure: [Smalltalk vmParameterAt: 67 put: extantLimit]!
Item was added:
+ ----- Method: AllocationTest>>setMaximumOldSpaceToAtLeast:around: (in category 'support') -----
+ setMaximumOldSpaceToAtLeast: bytes around: aBlock
+ "Attempt to evaluate aBlock with a limit of at least the requested maximum
+ size (in bytes) of old space, restoring the extant limit after the evaluation."
+
+ | extantLimit |
+ extantLimit := Smalltalk vmParameterAt: 67.
+ extantLimit >= bytes ifTrue:
+ [^aBlock value].
+ Smalltalk vmParameterAt: 67 put: (Smalltalk vmParameterAt: 1) + bytes asInteger.
+ ^aBlock ensure: [Smalltalk vmParameterAt: 67 put: extantLimit]!
Item was changed:
----- Method: AllocationTest>>testOneGigAllocation (in category 'tests') -----
testOneGigAllocation
+ self setMaximumOldSpaceToAtLeast: 1024 * 1024 * 1024 * (Smalltalk wordSize = 8
+ ifTrue: [4]
+ ifFalse: [1.5])
+ around:
+ [| sz array failed |
+ failed := false.
+ sz := 1024*1024*1024 / Smalltalk wordSize.
+ array := [Array new: sz]
+ on: OutOfMemory
+ do: [:ex| failed := true].
+ self assert: (failed or: [array isArray and: [array size = sz]])]!
- "Documentating a weird bug in the allocator"
- | sz array failed |
- failed := false.
- sz := 1024*1024*1024.
- array := [Array new: sz] on: OutOfMemory do:[:ex| failed := true].
- self assert: (failed or:[array size = sz]).
- !
Item was changed:
----- Method: AllocationTest>>testOutOfMemorySignal (in category 'tests') -----
testOutOfMemorySignal
"Ensure that OutOfMemory is signaled eventually. Restrain the available memory first to not stress the machine too much."
+ self setMaximumOldSpaceToAtLeast: 1024 * 1024 * 1024 * (Smalltalk wordSize = 8
- | sz |
- self setFreeSpaceLimitOf: 1024 * 1024 * 1024 * (Smalltalk wordSize = 8
ifTrue: [4]
ifFalse: [1.5])
around:
+ [| sz |
+ sz := 512*1024*1024. "work around the 1GB alloc bug" "what 1Gb allocation bug? eem"
- [sz := 512*1024*1024. "work around the 1GB alloc bug"
self should: [(1 to: 2000) collect: [:i| Array new: sz]] raise: OutOfMemory].!
More information about the Squeak-dev
mailing list
|