lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Bogdan Marinescu wrote:

I don't think the answer is that easy though :) I still suspect the allocator, just don't know how to prove it yet.

Since printf() works, you can sprinkle code into the allocator
functions, and then write up a little main loop that sets
up a buffer of 128 (or so pointers)

The set up a random number generator to randomly pick a slot
in the buffer and a size.

free( buffer[random_index] ) - an address of zero should be a no-op.

buffer[random_index] = malloc( random_size )

or

buffer[random_index] = realloc( buffer[random_index], random_size )

And watch your allocator work. It should ALWAYS return an aligned
address though.

Since Lua is starting up far enough to get to the point where
you can type stuff to the console, I doubt the allocator is
giving you trouble, but you never know...

Ralph
       Can you do something like:

       string[] = "abcdefgh"

       for( i=0; i<8; ++i )
         printf( "%s\n", &string[i] )


abcdefgh
bcdefgh
cdefgh
defgh
efgh
fgh
gh
h

Me too!

Ralph