I shoulda noted that my "simple" app all depends on the malloc in use by the
OS your on ....

for example (on an HP11.00) ... (and I changed the app to accentuate the
point)
bash-2.04$ cat test.c
#include <stdio.h>

int main(int argc, char** argv)
{
int a = atoi(argv[1]);
int i;
int j = 0;
void* b[a];
printf("starting loops\n");
{
    for (i=0; i<a; i++)
        b[i] = malloc(a);
    for (i=0; i<a; i++)
        free(b[i]);
    j++;
}
printf("ended loops\n");
sleep(10);
}

bash-2.04$ ./a.out 20000
starting loops
ended loops

At this point top shows ....
 1 pts/1  29528 curreyr  168 20   131M 31748K sleep    0:00  2.76  1.09
a.out

One might assume 131M in use right? Wrong, it just hasn't been reclaimed. A
different malloc will behave differently.

Rob

P.S. note that 20000*20000 != the 131M ...

----- Original Message -----
From: "Robert Currey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 14, 2004 12:30 PM
Subject: Re: Memory leaks when lots of graphical operations? [Qt/X11 3.1.1]


> Not sure how your checking memory usage either ...
>
> Consider a simple app like ...
>
> int main(int argc, char** argv)
> {
> int i;
> void* b;
> for (i=0; i<1000000; i++)
> {
>       b = malloc(1000000);
>       free(b);
> }
> sleep(200);
> }
>
> will show memory in use during the sleep ... but this app doesn't leak.
>
> Rob
>
> ----- Original Message -----
> From: "Mark Vojkovich" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, October 14, 2004 10:50 AM
> Subject: Re: Memory leaks when lots of graphical operations? [Qt/X11
3.1.1]
>
>
> >    It's the app's memory usage that climbs or the server's?
> >
> > Mark.
> >
> > On Thu, 14 Oct 2004, [iso-8859-1] Sébastien ZINSIUS wrote:
> >
> > > Hello!
> > >
> > > I'm currently developing a graphical application with Qt/X11 3.1.1.
This
> application does a lot of operations and I'm doing some robustness
tests...
> I have a test tool that can stimulate application and implies lot of
> drawing. The target on which application has to run is a mobile computer
> with a x86 compatible 133MHz CPU, 64 MB RAM and 256MB compactflash.
> > >
> > > My problem is that when frequency of update becomes to high, machine
> seems not to be able to treat all the graphical updates (well, it's my
> feeling...) and memory use (of application) climbs rapidely (according to
> this frequency).
> > >
> > > I looked into Qt source code and tried to print some X dependant
> informations, e.g. with XPending, and number of events that have to be
dealt
> by X server, seem to be the source of the problem.
> > >
> > > I tried this test on a faster machine (P4 2GHz 512MB) and problem
occurs
> also, but in very very strength conditions (2 thread running with a 1msec
> period and producing in each cycle about 100 operations).
> > >
> > > I thought that memory would be given back after the "stress period",
but
> I made the same test only on a 10 second period (stopping automatically
> stressing thread), and memory seems to be lost for eternity... (no memory
> use decrease followed)
> > >
> > > Do you have an idea why the memory use climbs? How could I solve this
> problem?
> > >
> > > Thanks in anticipation!
> > >
> > > Cheers,
> > >
> > > Sébastien
> > >
> > > _______________________________________________
> > > Devel mailing list
> > > [EMAIL PROTECTED]
> > > http://XFree86.Org/mailman/listinfo/devel
> > >
> >
> > _______________________________________________
> > Devel mailing list
> > [EMAIL PROTECTED]
> > http://XFree86.Org/mailman/listinfo/devel
> >
>
> _______________________________________________
> Devel mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/devel
>

_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to