Re: How to diagnose a kernel memory leak

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

 



If you don't do reply-to-all there's a chance people will miss out on
your mails...

> > It all looks pretty innocent.  Please send the contents of /proc/meminfo
> > rather than the `free' output.  /proc/meminfo has much more info. 
> 
> Here are the current meminfo numbers:
> 

What's happening with this? It's been a week now so I'm curious.

What you can do is run the attached program, it's a simple memory eater
that will eat the amount of memory you specify, ie. "./a.out 2000" will
simply eat 2G of memory. This is because all caches get reaped to a
minimum leavel and distinguishing trouble makes is easier this way.

If you think the machine has lost memory at this time please do:
gcc memeat.c
./a.out 2000
wait until program is done
save /proc/meminfo
save /proc/page_owner
sort page_owner output
#include <stdio.h>
#include <stdlib.h>

#define page_size 4096


int main(int argc, char *argv[])
{
	long size = strtoul(argv[1], NULL, 0);
	long curr = 0;

	printf("allocating %ldmb\n", size);
	
	size *= 1024 * 1024;

	while (curr <= size) {
		char *ptr = malloc(page_size);

		if (!ptr) {
			printf("Couldn't allocate after %ld\n", curr);
			sleep(1);
			continue;
		}
			
		memset(ptr, 0, page_size);
		curr += page_size;
	}

	return 0;
}
		


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux