[Vm-dev] newDelta >0 failed in sqUnixMemory

Damien Cassou damien.cassou at gmail.com
Sat Jan 31 10:15:02 UTC 2009

On Fri, Jan 30, 2009 at 6:29 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
>>> fprintf(stderr, "oldLimit=%p\ndelta=%d\nnewSize=%d\nnewDelta=%d\n");
>>> oldLimit=0x80562b8
>>> delta=-1077506096
>>> newSize=0
>>> newDelta=423027548
>>> squeak: /tmp/squeak-svn/platforms/unix/vm/sqUnixMemory.c:175:
>>> uxGrowMemoryBy: Assertion `newDelta >= 0' failed.
>>> Does it help?
>> Yes. I don't think newSize is supposed to be 0 here.
>>      int newSize=  min(valign(oldLimit - heap + delta), heapLimit);
>>      int newDelta= newSize - heapSize;
>> I'm not sure what is wrong, but apparently it's in the expression
>> "min(valign(oldLimit - heap + delta), heapLimit)".
> Could be a CSE bug. Considering that min(a,b) is usually defined as "a < b ?
> a : b" or so, a compiler might do something with the valign(...) expression.
> I would try to move the expression out of there and see if that helps.

Nobody noticed, but I did a very stupid mistake. Look at the call to
fprintf that I copy/pasted in my previous mail. I forgot all the
parameters :-). I don't how it is possible that gcc still compiled the

I moved valign out:

      int align = valign(oldLimit - heap + delta);
      int newSize= min(align, heapLimit);

And printed the values:

 if(newDelta < 0)

And got:

squeak: /tmp/squeak-svn/platforms/unix/vm/sqUnixMemory.c:175:
uxGrowMemoryBy: Assertion `newDelta >= 0' failed.

Does that make sense to anyone?

Damien Cassou

More information about the Vm-dev mailing list