mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Nyberg <alexn@dsv.su.se>
To: Bruce Guenter <bruceg@em.ca>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: How to diagnose a kernel memory leak
Date: Wed, 18 May 2005 20:32:53 +0200	[thread overview]
Message-ID: <1116441173.23209.17.camel@localhost.localdomain> (raw)
In-Reply-To: <20050513212816.GA29230@em.ca>

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

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

[-- Attachment #2: memeat.c --]
[-- Type: text/x-csrc, Size: 446 bytes --]

#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;
}
		


  reply	other threads:[~2005-05-18 18:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09  3:58 Bruce Guenter
2005-05-09  6:05 ` Zwane Mwaikambo
2005-05-09 14:20   ` Bruce Guenter
2005-05-09  8:29 ` Alexander Nyberg
2005-05-09 14:23   ` Bruce Guenter
2005-05-11 19:37   ` Bruce Guenter
2005-05-13  0:18     ` Andrew Morton
2005-05-13 21:28       ` Bruce Guenter
2005-05-18 18:32         ` Alexander Nyberg [this message]
2005-05-19 18:44           ` Bruce Guenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1116441173.23209.17.camel@localhost.localdomain \
    --to=alexn@dsv.su.se \
    --cc=akpm@osdl.org \
    --cc=bruceg@em.ca \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome