Finding Cause of Memory Leak


 
Thread Tools Search this Thread
Top Forums Web Development Finding Cause of Memory Leak
# 1  
Old 01-18-2013
Finding Cause of Memory Leak

Hi

We have just got a dedicated server with Fasthosts, O/S is Linux CentOS 6 64 bit.

It was a fresh install and I have just moved one WordPress site onto there.

The problem is we seem to be getting a memory leak (that's what Fasthosts said) and the database (I think) keeps crashing, so we have to restart the server. Here's details of the issue that Fasthosts sent:

Image

I don't really know how to go about trying to find the cause, my knowlege of UNIX is basic. I did check the mysqld.log file and there were lots of issues relating to the wp_options table, which became corrupt and I have to rebuild.

Any help much appreciated.

Thanks
Tom
# 2  
Old 01-18-2013
You need more information than "they said" and "they think".

If you tried to post any details below where you said 'details', it didn't paste.

[edit] Okay, your picture is loading now. It doesn't show any more information than that it's out of memory though, it doesn't help explain why.

Do you have sar running on that server or anything like it?

Can you post the output of cat /proc/meminfo?

Last edited by Corona688; 01-18-2013 at 12:21 PM..
# 3  
Old 01-18-2013
First you need to enable cores so that you can see what causes the crash (and be sure of the process that is crashing), as root
Code:
mkdir /cores
echo "/tmp/cores/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern

This will give you core file names that "just make sense(TM)"


Unfortunately the next step is a little complex, you need to run
Code:
gdb -c $core_file_name -e $path_to_named_executable_in_core

This will at least give you the reason for the crash
next run
Code:
gdb> bt -all

this will let you know what was happening at the time of the crash, however gdb is a bit arcane for someone whose knowledge of Linux is limited
# 4  
Old 01-18-2013
Thanks for the replies.

Corona:
I've posted the output of meminfo below. I don't know what sar is, sorry.

Skrynesaver:
I've managed the first bit of your code, but you've lost me at step 2 sorry, I don't know what the core filename or path to executable are.

MemTotal: 3563324 kB
MemFree: 1827040 kB
Buffers: 53532 kB
Cached: 306200 kB
SwapCached: 0 kB
Active: 1404968 kB
Inactive: 150292 kB
Active(anon): 1195840 kB
Inactive(anon): 4724 kB
Active(file): 209128 kB
Inactive(file): 145568 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4194288 kB
SwapFree: 4194288 kB
Dirty: 3588 kB
Writeback: 0 kB
AnonPages: 1195520 kB
Mapped: 33712 kB
Shmem: 5040 kB
Slab: 95536 kB
SReclaimable: 65852 kB
SUnreclaim: 29684 kB
KernelStack: 1360 kB
PageTables: 22760 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 5975948 kB
Committed_AS: 1752156 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 299972 kB
VmallocChunk: 34359434188 kB
HardwareCorrupted: 0 kB
AnonHugePages: 917504 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 8832 kB
DirectMap2M: 3821568 kB
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Memory leak

Hi all I am using RED HAT 5.4, and i am getting memory uses problem. when i use "sync;echo 3 > /proc/sys/vm/drop_cache" command the memory will release after 2,3 hour memory show 95%. pls suggest right way. thanks (37 Replies)
Discussion started by: reply.ravi
37 Replies

2. Programming

Memory Leak

Hi, I am trying a database server which keeps a B+ plus tree structure and works on it. I am trying to find the memory used/leak while executing this process. I check the memory leak by using ps uax command. When i execute a delete query i am sure that my code frees up the existing... (9 Replies)
Discussion started by: kumaran_5555
9 Replies

3. HP-UX

Problem with memory leak

Hi, This is my 1st post here. I am facing a rather weired problem. I have a C++ binary running on HP-UX. The output of top as well as glance shows periodic increase in memory. But when i use gdb to detect it, i dont get the desired output...gdb says...no leaks found. Just to mention that I have... (2 Replies)
Discussion started by: kshk123
2 Replies

4. Programming

memory leak problem

hi all Can any one plz explain me about memory leak problem Thankx (5 Replies)
Discussion started by: sonali
5 Replies

5. IP Networking

memory leak?

Hi All, my client server application can work in two modes: 1) one direction - only client sends msgs to server 2) two directions - server gives 'answers' to client. when program run in the first mode it looks OK, but when server answers to client than client's application exit its... (2 Replies)
Discussion started by: lenna
2 Replies

6. UNIX for Advanced & Expert Users

Memory leak in pthread

helo frnds, I am using RHEL5 and C lang for development. I am getting some memory leak problem in pthread. I hav developed a program which creates two threads for listening purpose on two diff ports. both the child threads are doing same job but on diff port no. I am using... (4 Replies)
Discussion started by: mindTeaser
4 Replies

7. Programming

Memory LEAK with pthreads

I have this code... #include <stdio.h> #include <iostream> #include <pthread.h> static void* cliente(void *datos); int main() { pthread_attr_t tattr; int ret; size_t size = PTHREAD_STACK_MIN + 0x0100; ret = pthread_attr_init(&tattr); ret =... (8 Replies)
Discussion started by: JEscola
8 Replies

8. UNIX for Advanced & Expert Users

Memory leak while using pthread_cancel()

I tried to execute a sample pthread program to cancel a newly created one using pthread_cancel(). but using valgrind on my code shows some memory leak. My Code: #include "iostream" #include "unistd.h" #include "pthread.h" #include "signal.h" using namespace std; void handler(int); void*... (4 Replies)
Discussion started by: kcr
4 Replies

9. Programming

about virtual memory and memory leak

Hi, First of all I appreciate this group very much for its informative discussions and posts. Here is my question. I have one process whose virtual memory size increases linearly from 6MB to 12MB in 20 minutes. Does that mean my process has memory leaks? In what cases does the... (4 Replies)
Discussion started by: shriashishpatil
4 Replies
Login or Register to Ask a Question