summaryrefslogtreecommitdiff
path: root/src/backend/utils/mmgr/aset.c
Commit message (Collapse)AuthorAgeFilesLines
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-241-2/+2
|
* Improve realloc() per idea from Karel Zak --- if chunk to be enlarged isTom Lane2001-01-231-2/+52
| | | | at end of its block, maybe we can enlarge it in-place.
* Add more critical-section calls: all code sections that hold spinlocksTom Lane2001-01-121-17/+19
| | | | | | | | | | | are now critical sections, so as to ensure die() won't interrupt us while we are munging shared-memory data structures. Avoid insecure intermediate states in some code that proc_exit will call, like palloc/pfree. Rename START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be what people tend to call them anyway, and make them be called with () like a function call, in hopes of not confusing pg_indent. I doubt that this is sufficient to make SIGTERM safe anywhere; there's just too much code that could get invoked during proc_exit().
* Log memory context stats to stderr when reporting a 'Memory exhausted'Tom Lane2001-01-061-1/+13
| | | | error, so as to provide a starting point for debugging.
* I've just seen what happens when the MEMORY_CONTEXT_CHECKING code firesTom Lane2000-12-051-9/+13
| | | | | an error at end of transaction ... and I did *not* like it. Reduce ERROR to NOTICE so that this situation doesn't cause an infinite loop.
* Pursuant to a pghackers discussion back around 11-Jul-00, get rid of aset.c'sTom Lane2000-12-011-167/+204
| | | | | | | not-very-good handling of mid-size allocation requests. Do everything via either the "small" case (chunk size rounded up to power of 2) or the "large" case (pass it straight off to malloc()). Increase the number of freelists a little to set the breakpoint between these behaviors at 8K.
* Clean up MEMORY_CONTEXT_CHECKING code, and apply it more thoroughly. Also,Tom Lane2000-12-011-170/+202
| | | | | apply Karel Zak's patch to recycle residual space in an exhausted allocation block. (Bet you thought I'd forgot about that, Karel?)
* Make pgsql compile on FreeBSD-alpha.Bruce Momjian2000-11-161-7/+7
| | | | | | | | | | | | | | | | | | Context diff this time. Remove -m486 compile args for FreeBSD-i386, compile -O2 on i386. Compile with only -O on alpha for codegen safety. Make the port use the TEST_AND_SET for alpha and i386 on FreeBSD. Fix a lot of bogus string formats for outputting pointers (cast to int and %u/%x replaced with no cast and %p), and 'Size'(size_t) are now cast to 'unsigned long' and output with %lu/ Remove an unused variable. Alfred Perlstein
* Repair missing MEMORY_CONTEXT_CHECKING logic for realloc().Tom Lane2000-07-121-2/+11
| | | | | Doesn't anyone around here run regression tests before submitting patches, or before committing them?
* First stage of reclaiming memory in executor by resetting short-termTom Lane2000-07-121-6/+7
| | | | | | memory contexts. Currently, only leaks in expressions executed as quals or projections are handled. Clean up some old dead cruft in executor while at it --- unused fields in state nodes, that sort of thing.
* Here is the patch with memory leak checker. This checker allow detectBruce Momjian2000-07-111-29/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in-chunk leaks, overwrite-next-chunk leaks and overwrite block-freeptr leaks. A in-chunk leak --- if something overwrite space after wanted (via palloc() size, but it is still inside chunk. For example x = palloc(12); /* create 16b chunk */ memset(x, '#', 13); this leak is in the current source total invisible, because chunk is 16b and leak is in the "align space". For this feature I add data_size to StandardChunk, and all memory which go from AllocSetAlloc() is marked as 0x7F. The MemoryContextCheck() is compiled '#ifdef USE_ASSERT_CHECKING'. I add this checking to 'tcop/postgres.c' and is active after each backend query, but it is probably not sufficient, because some MemoryContext exist only during memory processing --- will good if someone who known where it is needful (Tom:-) add it for others contexts; A problem in the current source is that we have still some malloc() allocation that is not needful and this allocation is total invisible for all context routines. For example Dllist in backend (pretty dirty it is in catcache where values in Dllist are palloc-ed, but list is malloc-ed). --- and BTW. this Dllist design stand in the way for query cache :-) Tom, if you agree I start replace some mallocs. BTW. --- Tom, have you idea for across transaction presistent allocation for SQL functions? (like regex - now it is via malloc) I almost forget. I add one if() to AllocSetAlloc(), for 'size' that are greater than ALLOC_BIGCHUNK_LIMIT is not needful check AllocSetFreeIndex(), because 'fidx' is always 'ALLOCSET_NUM_FREELISTS - 1'. It a little brisk up allocation for very large chunks. Right? Karel
* First phase of memory management rewrite (see backend/utils/mmgr/READMETom Lane2000-06-281-112/+253
| | | | | | | | | | | | | for details). It doesn't really do that much yet, since there are no short-term memory contexts in the executor, but the infrastructure is in place and long-term contexts are handled reasonably. A few long- standing bugs have been fixed, such as 'VACUUM; anything' in a single query string crashing. Also, out-of-memory is now considered a recoverable ERROR, not FATAL. Eliminate a large amount of crufty, now-dead code in and around memory management. Fix problem with holding off SIGTRAP, SIGSEGV, etc in postmaster and backend startup.
* Add debug code to aid in memory-leak tracking: if SHOW_MEMORY_STATS isTom Lane2000-05-211-1/+39
| | | | | defined then statistics about memory usage of all the global memory contexts are printed after each commit.
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-121-10/+14
|
* Extend #ifdef CLOBBER_FREED_MEMORY debugging option so that memoryTom Lane2000-03-081-1/+9
| | | | freed wholesale by AllocSetReset() is overwritten too.
* Fix problems seen in parallel regress tests when SI buffer overruns (causingTom Lane2000-01-311-1/+6
| | | | | | | | | | | | | | | | | | | | | | | syscache and relcache flushes). Relcache entry rebuild now preserves original tupledesc, rewrite rules, and triggers if possible, so that pointers to these things remain valid --- if these things change while relcache entry has positive refcount, we elog(ERROR) to avoid later crash. Arrange for xact-local rels to be rebuilt when an SI inval message is seen for them, so that they are updated by CommandCounterIncrement the same as regular rels. (This is useful because of Hiroshi's recent changes to process our own SI messages at CommandCounterIncrement time.) This allows simplification of some routines that previously hacked around the lack of an automatic update. catcache now keeps its own copy of tupledesc for its relation, rather than depending on the relcache's copy; this avoids needing to reinitialize catcache during a cache flush, which saves some cycles and eliminates nasty circularity problems that occur if a cache flush happens while trying to initialize a catcache. Eliminate a number of permanent memory leaks that used to happen during catcache or relcache flush; not least of which was that catcache never freed any cached tuples! (Rule parsetree storage is still leaked, however; will fix that separately.) Nothing done yet about code that uses tuples retrieved by SearchSysCache for longer than is safe.
* Add:Bruce Momjian2000-01-261-2/+3
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* Fix it's and its to be correct.Bruce Momjian2000-01-051-2/+2
|
* Alter AllocSet routines so that requests larger thanTom Lane1999-08-241-40/+133
| | | | | | | | | | ALLOC_BIGCHUNK_LIMIT are always allocated as separate malloc() blocks, and are free()d immediately upon pfree(). Also, if such a chunk is enlarged with repalloc(), translate the operation into a realloc() so as to minimize memory usage. Of course, these large chunks still get freed automatically if the alloc set is reset. I have set ALLOC_BIGCHUNK_LIMIT at 64K for now, but perhaps another size would be better?
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-171-7/+1
|
* Final cleanupBruce Momjian1999-07-161-1/+2
|
* Update #include cleanupsBruce Momjian1999-07-161-2/+2
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-151-3/+1
|
* pgindent run over code.Bruce Momjian1999-05-251-47/+51
|
* Modify aset.c logic so that blocks requested from malloc getTom Lane1999-05-221-31/+114
| | | | | bigger the more space is used in an allocset. This reduces the malloc overhead very substantially on queries that need lots of memory.
* Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian1999-02-131-9/+9
|
* Fixed problem with multiple portals shown up in portals_p2 regressionJan Wieck1999-02-071-10/+1
| | | | | | | | test after new AllocSet code. Activated optimal AllocSet blocksize and chunk limit. Jan
* New alloc set code using a memory block pool for small allocations.Jan Wieck1999-02-061-198/+169
| | | | Jan
* OK, folks, here is the pgindent output.Bruce Momjian1998-09-011-3/+2
|
* Renaming cleanup, no pgindent yet.Bruce Momjian1998-09-011-8/+8
|
* Remove un-needed braces around single statements.Bruce Momjian1998-06-151-15/+1
|
* Add typdefs to pgindent run.Bruce Momjian1997-09-081-2/+2
|
* Another PGINDENT run that changes variable indenting and case label ↵Bruce Momjian1997-09-081-19/+19
| | | | indenting. Also static variable indenting.
* Massive commit to run PGINDENT on all *.c and *.h files.Bruce Momjian1997-09-071-199/+212
|
* Make functions static where possible, enclose unused functions in #ifdef ↵Bruce Momjian1997-08-191-3/+9
| | | | NOT_USED.
* All external function definitions now have prototypes that are checked.Bruce Momjian1996-11-101-1/+3
|
* Compile and warning cleanupBruce Momjian1996-11-081-2/+2
|
* Another directory that compiles with no errors, and few warningsMarc G. Fournier1996-11-061-4/+7
|
* Postgres95 1.01 Distribution - Virgin SourcesPG95-1_01Marc G. Fournier1996-07-091-0/+381