The Trunk: KernelTests-ar.117.mcz

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

The Trunk: KernelTests-ar.117.mcz

commits-2
Andreas Raab uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ar.117.mcz

==================== Summary ====================

Name: KernelTests-ar.117
Author: ar
Time: 4 December 2009, 2:18:34 am
UUID: 367a2844-bcb2-6c4d-94ff-574636422c6b
Ancestors: KernelTests-ul.116

AllocationTests covering the behavior on excessive allocations.

=============== Diff against KernelTests-ul.116 ===============

Item was added:
+ ----- Method: AllocationTest>>testOneMegAllocation (in category 'tests') -----
+ testOneMegAllocation
+ "Documentating a weird bug in the allocator"
+ | sz array failed |
+ failed := false.
+ sz := 1024*1024.
+ array := [Array new: sz] on: OutOfMemory do:[:ex| failed := true].
+ self assert: (failed or:[array size = sz]).
+ !

Item was added:
+ ----- Method: AllocationTest>>testOutOfMemorySignal (in category 'tests') -----
+ testOutOfMemorySignal
+ "Ensure that OOM is signaled eventually"
+ | sz |
+ sz := 512*1024*1024. "work around the 1GB alloc bug"
+ self should:[2000 timesRepeat:[Array new: sz]] raise: OutOfMemory.
+
+ "Call me when this test fails, I want your machine"
+ sz := 1024*1024*1024*1024.
+ self should:[Array new: sz] raise: OutOfMemory.
+ !

Item was added:
+ TestCase subclass: #AllocationTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Objects'!

Item was added:
+ ----- Method: AllocationTest>>testOneGigAllocation (in category 'tests') -----
+ testOneGigAllocation
+ "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]).
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: KernelTests-ar.117.mcz

Bert Freudenberg
On 04.12.2009, at 23:18, [hidden email] wrote:
>
> + testOutOfMemorySignal
> + "Ensure that OOM is signaled eventually"
> + | sz |
> + sz := 512*1024*1024. "work around the 1GB alloc bug"
> + self should:[2000 timesRepeat:[Array new: sz]] raise: OutOfMemory.

So this allocates 2 GB arrays. But since it does not hold onto each array, why should it make a difference if you repeat it one or 2000 times? I mean, provided the garbage collector is doing its job, it should work the same for any number of iterations, right?

I just tried

        100 timesRepeat: [Array new: 100*1024*1024]

which works without raising an error. After this, Squeak slows to a crawl, but it does continue at maybe 1 fps (Etoys 4.0, Mac VM 4.2.2b1). The Mac OS activity monitor says it's spending 80% in markAndTrace(). So the GC doesn't like this at all - but it does work.

- Bert -