Calling 'straight' C code (was RE: Another silly primitive question)

Andrew C. Greenberg werdna at gate.net
Thu Feb 18 01:46:51 UTC 1999


I wrote:


>> External memory and external calls
>> ==================================


> I was thinking about something along these lines.  What if the VM 
> simply were to reserve a (configurable) block when booting (taking 
> up either a command line parameter or a number from a file, 
> defaulting to zeroK) which would be reserved for traditional heap 
> calls below memory and thus, transparent to the system.  The 
> plugins would simply choke in the traditional manner if there were 
> insufficient memory, and all that would need to be done is to 
> change the parm and reboot Squeak.  This seems like it should be as 
> easy as adding a constant to "memory" before starting up the VM, 
> and then providing some straightforward services to access the 
> "fixed heap."

Silly me, I just went and looked again at the code.  Squeak does 
precisely this already, reserving some amount for system-related 
resources, and then allocating the balance to the image.  [I had 
presumed that it had the facility to increase the size of its 
allocation dynamically.]

Accordingly, it appears that all we really need for a general 
facility in terms of VM hacking (if at all) is to take that number 
and make it a parameter of some sort, and then use whatever system 
calls are there.  I note that on the Mac, half a meg is already 
reserved.  On the other hand, a half meg is a nice piece of change 
for most libraries.  Anyone know how much of that is "spoken for" in 
other ways or whether the system would get upset if that were 
somewhat fragmented for whatever reason?





More information about the Squeak-dev mailing list