Discussion:
The Inbox: System-cmm.1044.mcz
(too old to reply)
c***@source.squeak.org
0000-11-17 23:53:43 UTC
Permalink
Chris Muller uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-cmm.1044.mcz

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

Name: System-cmm.1044
Author: cmm
Time: 16 November 2018, 5:53:02.580292 pm
UUID: 3b9fe1d6-6eed-468f-91d7-e26350c972f6
Ancestors: System-pre.1043

Utility methods for determining how much RAM is used, and how much is available to the running image.

=============== Diff against System-pre.1043 ===============

Item was added:
+ ----- Method: SmalltalkImage>>bitsPerWord (in category 'system attributes') -----
+ bitsPerWord
+ ^ self wordSize * 8!

Item was added:
+ ----- Method: SmalltalkImage>>defaultMaxMemory (in category 'memory space') -----
+ defaultMaxMemory
+ "Images can be up to 1GB (512MB on Windows) when the -memory parameter is not specified."
+ ^ self isRunningSpur
+ ifTrue:
+ [ self is64Bit
+ ifTrue: [ 15000000000 ]
+ ifFalse: [ 3800000000 ] ]
+ ifFalse:
+ [ Smalltalk platformName = 'Win32'
+ ifTrue: [ 500000000 ]
+ ifFalse: [ 1000000000 ] ]!

Item was added:
+ ----- Method: SmalltalkImage>>is32Bit (in category 'system attributes') -----
+ is32Bit
+ ^self bitsPerWord = 32!

Item was added:
+ ----- Method: SmalltalkImage>>is64Bit (in category 'system attributes') -----
+ is64Bit
+ ^self bitsPerWord = 64!

Item was added:
+ ----- Method: SmalltalkImage>>maxMemory (in category 'memory space') -----
+ maxMemory
+ "If the special argument to the vm, -memory, was provided, use the number following it, otherwise the default maximum available based on the image / vm type."
+ | foundMemoryArg |
+ foundMemoryArg := false.
+ self optionsDo:
+ [ : each |
+ (#('-memory' '-mmap') includes: each)
+ ifTrue: [ foundMemoryArg := true ]
+ ifFalse:
+ [ foundMemoryArg ifTrue:
+ [ | arg |
+ arg := each.
+ (arg isEmptyOrNil or: [ arg size < 2 ]) ifFalse:
+ [ | requestedMemory |
+ requestedMemory := (arg
+ copyFrom: 1
+ to: arg size - 1) asNumber.
+ requestedMemory > 0 ifTrue:
+ [ arg last = $k
+ ifTrue: [ ^ 1000 * requestedMemory min: self defaultMaxMemory ]
+ ifFalse: [ arg last = $m ifTrue: [ ^ 1000000 * requestedMemory min: self defaultMaxMemory ] ] ] ] ] ] ].
+ ^ self defaultMaxMemory!

Item was added:
+ ----- Method: SmalltalkImage>>memoryAvailable (in category 'memory space') -----
+ memoryAvailable
+ "Answer the remaining memory available accessible by this image."
+ ^ self maxMemory - self memoryUsed!

Item was added:
+ ----- Method: SmalltalkImage>>memoryUsed (in category 'memory spa
Loading...