[haiku-development] Weird memory behaviour.
- From: Bruno Albuquerque <bga@xxxxxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Thu, 24 Jul 2008 10:27:48 -0300
First, a bit of background: When checking our the sources inside haiku
using R5's svn client, the amount of used memory starts to increase
until, it reaches around 1.3 Gb at the end of the checkout process. This
could even be considered ok if it was not for the fact that even after
svn closes, the 1.3 Gb of memory is still in use by the kernel and this
does not go down. As a reference, my machine has 3 Gb of memory usable
by Haiku and around 1.5 Gb are in use by caches when svn finishes. Note
that it is 1.5 Gb of caches plus 1.3 Gb of actual used memory that I see.
Anyway, I decided to track this bug down and did some very simple
experiments to try to track down the memory behaviour and I saw
something interesting:
1 - Right now, I am running haiku under VMWare. ActivityMonitor is open
and it shows 95.9 Mb of used memory and 19.6 Mb of cached memory.
2 - I compiled the following simple program under Haiku:
#include <unistd.h>
int main(void) {
char* test - new char[1024 * 1024 * 500]
sleep(5); // Give some time so AM can pick the change.
// Intentionally leak allocated memory.
}
3 - When running it, Activity monitor does pick the memory change
(memory usage goes up to 683.4 Mb) and, when the program exists, cleanup
happens as expected (memory usage goes back to 95.9 Mb).
4 - What is weird is that, at the same time, Cached memory goes *DOWN*
to -567.6 Mb (yep, a negative number) which led me to believe that
somewhere we are unconditionally decreasing the amount of cached memory
even when we do not need to do that to allocate the required memory.
5 - This could also see the reason why I see 1,3 Gb in use by the kernel
after a svn checkout as it could actually be cache memory that was
incorrectly tracked as used memory due to something related to above.
I will continue investigating it but as I am at work now I won't be able
to dedicate too much time to it. if you have any idea about what could
be happening, please say so. :)
-Bruno
- Follow-Ups:
- [haiku-development] Re: Weird memory behaviour.
- From: Bruno Albuquerque
- [haiku-development] Re: Weird memory behaviour.
- From: Bruno Albuquerque
Other related posts:
- » [haiku-development] Weird memory behaviour.
- » [haiku-development] Re: Weird memory behaviour.
- » [haiku-development] Re: Weird memory behaviour.
- » [haiku-development] Re: Weird memory behaviour.
- [haiku-development] Re: Weird memory behaviour.
- From: Bruno Albuquerque
- [haiku-development] Re: Weird memory behaviour.
- From: Bruno Albuquerque