| From: | Steve Adams |
| Date: | 23-Nov-2000 09:21 |
| Subject: | Ixora News - November 2000 - Sort memory |
|
|
Oracle does not attempt to free unused heap memory to Unix at all. What I said was, "Once the last row has been fetched, all sort memory is released to UGA heap, and most of it is then immediately released to its parent heap (the PGA, or SGA in MTS connections). Free/unused PGA memory will be readily paged out by the operating system under memory pressure." That is, the free memory remains in the PGA. Oracle relies on the operating system to page out unused PGA memory if necessary. It is theoretically possible to return unused memory to Unix using sbrk() with a negative increment. But that would greatly complicate and increase the cost of Oracle's memory management and it is not warranted given that it is only virtual memory anyway, not physical memory. You can confirm that Oracle does not call sbrk() by checking the symbols in its object files using nm(1). So it is not a "bug". Oracle intentionally leaves unused heap memory in process virtual address space and it will remain mapped to some physical memory if the operating system does not need that physical memory for anything else. All that means is that you have to get your memory usage statistics from Oracle, rather than from the operating system. If you rely on the operating system memory usage information then, yes, it may appear that Oracle's sort memory remains allocated for the life of the process (not session) but that appearance is just an illusion.
|
![]() |
In the Oracle Internals class I took earlier this year the instructor mentioned that due to a bug of some sort, while Oracle instructs the OS to release memory after the sort is finished this will not happen on UNIX systems (it will on NT). Thus a single sort could leave the memory allocated for the life of the session. Do you have reason to either believe or disbelieve this statement?
|