I am curious about this palloc, what exactly does this do? I tried
replacing my mallocs/frees with pallocs/pfrees, my code still doesn't
work but now the error message gives me this:
PANIC: stuck spinlock (cdcaf910) detected at freelist.c:258
STATEMENT: CREATE TABLE my_table (field VARCHAR(25));
LOG: server process (PID 10605) was terminated by signal 6
LOG: terminating any other active server processes
LOG: all server processes terminated; reinitializing
FATAL: shmat(id=50331794) failed: Not enough space
Not exactly the same every time though. Is the error just more
descriptive or is another error being created?
palloc is the postgres "wrapper" for malloc, and pfree the "wrapper"
for pfree. These use something called a region-based memory
allocator, which you may learn about in HW2. Meanwhile, just use them
as you would use malloc/free.
The error you're seeing could be because you're trying to allocate too
much memory (try something modest like 16 8K pages, i.e. 16*8*1024
bytes). Or it could be a problem with torus, but I would not jump to
that conclusion without examining your code carefully -- if torus is
in trouble there will be a lot of noise on the newsgroup!
J
To clarify my comment about trying to allocate 16*8*1024 bytes, that's
just an experiment you might want to try. I suspect you're wanting to
allocate much less for your purposes in this homework...
J