Re: Memory leaks / Help with memprof & ps output
- From: Jason Tackaberry <tack auc ca>
- To: Joe Pfeiffer <pfeiffer cs nmsu edu>
- Cc: gtk-list gnome org
- Subject: Re: Memory leaks / Help with memprof & ps output
- Date: 04 Apr 2002 09:58:45 -0500
On Thu, 2002-04-04 at 01:31, Joe Pfeiffer wrote:
> Remember, you're looking at the virtual space, not (necessarily) the
> physical memory. Unix-related OSes regard virtual space as
> essentially free: once a process has used to malloc to get some
> virtual space from the OS, it doesn't ever give it back (until the
> process dies, anyway).
Okay, but that's seems inconsistent with this simple malloc test:
#include <stdio.h>
#include <glib.h>
void main() {
char *p = g_new0(char, 1024*1024*100);
g_print("1. Check memory usage...");
getchar();
g_free(p);
g_print("2. Check again...");
getchar();
}
Checking memory usage at (1) shows 100M of RSS, and at (2), shows 600k
or so. Did I misunderstand you?
What boggles me is that it even works with loading 100M of images with
gdk_pixbuf (in a simple, similar program to the above) in that after I
unref them the RSS drops back down to the original size. memprof again
shows a big blue bar, and ps shows a sane RSS. But in my original
program, even though memprof shows all the memory is being freed, my RSS
never drops. So I'm still confused. ;)
Thanks for your reply,
Jason.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]