> > I'm also not entirely sure if it indeed is a leak in my program as I
> > have a routine in it which constantly (20 times/sec) checks the memory
> > usage (via /proc) of my program and does an exit() when it reaches
> > 500MB (normally it should not use more than 120MB).
> > If it is something in Xorg, would valgrind "see" this? I think it
> > would (not sure, that's why I ask) as it would be the outcome of a
> > call to it (via SDL/GL).
> I guess you mean by  Xorg the separate system process handling
> the X display ?
> Valgrind will not monitor what is happening in this separate
> process, unless it is launched under Valgrind.

I think I found it.
When developing this application I decided that it would be cleaner to
use unsigned ints when applicable.
That's indeed very clean but a hell when fixing bugs: when something
goes wrong and a negative value is put in such an unsigned integer, a
very large positive value is set in reality. For example: unsigned
short x = -1; would give x=65535.
So when this happens, my program would allocate gigabytes of ram. And
since I used --malloc-fill=, valgrind would then initialize this ram
(I'm speculating here) causing big time swapping. I found this out by
disabling swap memory.
So either I'm totally wrong and something else is going wrong or it
might be nice to implement "lazy malloc fill" which initializes pages
to that value only when a pagefault occurs. Might help overcommit as
well.

--
www.vanheusden.com
bitcoin account: 14ExronPRN44urf4jqPMyoAN46T75MKGgP
msn address: [email protected]

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to