I'm looking into ways of minimizing memory consumption of my software and right now I'm trying a certain new idea of mine. But before I implemented it I compilied a program that doesn't do ANYTHING expect include the unistd.h POSIX-header and then calls wait(1000); to see the mem usage of a "blank" app.
// libsplit.cc ----------------------
#include "unistd.h"
#include "object.hh"
int main()
{
sleep(1000);
} // end int main()
// object.hh ---------------------
#ifndef _OBJECT_HH_
#define _OBJECT_HH_
class cObject
{
public:
char name[20];
}; // end class cObject
#endif
And to my shock Gnome-System-Monitor reports:
Memory: 7.5 MB
Virtual Memory: 11.4 MB
Resident Memory: 7.5 MB
Not that much but crazy for a program that doesn't do anything! Also gPS (another system monitor) reports the same values as Gnome-System-Monitor so there is nothing wrong with GSM.
For comparison the usage of Fluxbox:
Memory: 2.7 MB
Virtual Memory: 6.5 MB
Resident Memory: 2.5 MB
And my hacked version of AEWM++ (which is much simpler then Fluxbox):
Memory: 1.8 MB
Virtual Memory: 11.5 MB
Resident Memory: 8.1 MB
So obviously there is something wrong with my compiler-linker setup. Ive tried compiling using both
g++ libsplit.cc -o libsplit -g -02 -march=i686 -Wall
and letting Scons decide for it self. In both cases the results are identical.
Any ideas?