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

Re: Postgresql wont restart. Can I clear shared memmory segments without rebooting?



Mitchell Laks put forth on 1/6/2010 1:27 AM:
> On 02:39 Tue 05 Jan     , Stan Hoeppner wrote:
>> Try these:
>>
>> To free pagecache:
>>
>> # echo 1 > /proc/sys/vm/drop_caches
>>
>> To free dentries and inodes:
>>
>> # echo 2 > /proc/sys/vm/drop_caches
>>
>> To free pagecache, dentries and inodes:
>>
>> echo 3 > /proc/sys/vm/drop_caches
> 
> this was very helpful. Exactly what I was looking for. I was able to read more about this
> and hopefully next time it happens, I will understand how to proceed.
> I was able to look this info about pagecache and shared memory up and learn about it!

You're welcome.  The big question though is why this is happening in the first
place.  Your top output showed 750MB+ in the cache on a system with 1GB ram.
That's 3/4 of your system memory occupied by cached disk file pages, which is
quite normal for Linux.  At the time postgre could have had at most 250MB
allocated to it.

When postgre asks the kernel for more memory, the kernel should automatically
flush some pages out of the cache and reallocate those memory pages to satisfy
postgre's request for more memory.  You should _never_ have to do this manually
with those hacks I provided.  The Linux kernel should always do this automatically.

I fear something is quite wrong with your system, either with your kernel or
with postgre.

--
Stan


Reply to: