Hi guys,

I've been looking through the memory management system today.

When a request is made for a memory memory chunk larger than
ALLOC_CHUNK_LIMIT, AllocSetAlloc() uses malloc() to give the request its
own block. The result is tested by AllocSetAlloc() to see if the memory
was allocated.

Irrespective of this, a chunk can be returned which has not had memory
allocated to it. There is no testing of the return status of
palloc() through out the code. 

Was/has this been addressed?

Thanks

Gavin


Thu, 8 Mar 2001 22:28:50 +1100 (EST)
Gavin Sherry <swm@linuxworld.com.au>
Memory management, palloc
On Thu, Mar 08, 2001 at 10:28:50PM +1100, Gavin Sherry wrote:
> Hi guys,
> 
> I've been looking through the memory management system today.
> 
> When a request is made for a memory memory chunk larger than
> ALLOC_CHUNK_LIMIT, AllocSetAlloc() uses malloc() to give the request its
> own block. The result is tested by AllocSetAlloc() to see if the memory
> was allocated.
> 
> Irrespective of this, a chunk can be returned which has not had memory
> allocated to it. There is no testing of the return status of
> palloc() through out the code. 

 I don't understand. If some memory is not obtain in AllocSetAlloc()
all finish with elog(ERROR). Not exists way how return insufficient 
space. Or not?

		Karel

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Thu, 8 Mar 2001 15:54:29 +0100
Karel Zak <zakkr@zf.jcu.cz>
Re: Memory management, palloc
Gavin Sherry <swm@linuxworld.com.au> writes:
> I've been looking through the memory management system today.

> When a request is made for a memory memory chunk larger than
> ALLOC_CHUNK_LIMIT, AllocSetAlloc() uses malloc() to give the request its
> own block. The result is tested by AllocSetAlloc() to see if the memory
> was allocated.

> Irrespective of this, a chunk can be returned which has not had memory
> allocated to it. There is no testing of the return status of
> palloc() through out the code. 

What's your point?

palloc() does not have the same specification as malloc.  It guarantees
to return allocated memory, or elog trying.

			regards, tom lane

Thu, 08 Mar 2001 10:14:12 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Memory management, palloc 
Karel,

On Thu, 8 Mar 2001, Karel Zak wrote:

> On Thu, Mar 08, 2001 at 10:28:50PM +1100, Gavin Sherry wrote:
> > Hi guys,
> > 
> > I've been looking through the memory management system today.
> > 
> > When a request is made for a memory memory chunk larger than
> > ALLOC_CHUNK_LIMIT, AllocSetAlloc() uses malloc() to give the request its
> > own block. The result is tested by AllocSetAlloc() to see if the memory
> > was allocated.
> > 
> > Irrespective of this, a chunk can be returned which has not had memory
> > allocated to it. There is no testing of the return status of
> > palloc() through out the code. 
> 
>  I don't understand. If some memory is not obtain in AllocSetAlloc()
> all finish with elog(ERROR). Not exists way how return insufficient 
> space. Or not?

Ahh. Of course. My mistake =)

Gavin


Fri, 9 Mar 2001 02:19:14 +1100 (EST)
Gavin Sherry <swm@linuxworld.com.au>
Re: Memory management, palloc