[Vm-dev] the initial memory allocation interface...
John M McIntosh
johnmci at smalltalkconsulting.com
Fri Jul 24 23:20:28 UTC 2009
Also all the unix based systems (is there any other kind) just fiddle
with the sqGrowMemoryBy logic by moving a pointer about indicating
where the end of memory is since
they all allocate the entire heapsize via mmap at startup time. Since
all those unix systems do lazy allocation of memory the fact you ask
for 1GB but use 20MB doesn't *really*(1)
matter.
In the past some VM developers have be *confused* about what that does
and implemented logic to remap the image memory based on grow/shrink,
but later discover fascinating
bugs with how the remap works, or the expensive of doing so.
(1) Well it does in terms of memory used to track that 1GB of virtual
memory
On 24-Jul-09, at 3:42 PM, Eliot Miranda wrote:
> unsigned long
> sqGrowMemoryBy(sqInt delta)
> {
> return memoryLimit;
> }
>
> and everywhere in the VM which expects the old sqGrowMemoryBy to
> answer a pointer to the limit must instead add the result to the
> base of allocated memory; i.e.
>
> limit := self sqGrowMemory: memoryLimit By: delta.
> limit = memoryLimit ifFalse:
> [self setMemoryLimit: limit - 24. "remove a tad for
> safety"
> self initializeMemoryFirstFree: freeBlock]
>
> is rewritten as
>
> limit := memoryLimit + (self sqGrowMemoryBy: delta).
> limit = memoryLimit ifFalse:
> [self setMemoryLimit: limit - 24. "remove a tad for
> safety"
> self initializeMemoryFirstFree: freeBlock]
> Opinions?
>
> best
> Eliot
--
=
=
=
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> Twitter:
squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
=
=
=
========================================================================
More information about the Vm-dev
mailing list