Thank you all for your explanations.
However, my little test program keeps eating up more and more real, not only
virtual, memory.
Here is my test code for Linux:
//------------------------------main.cpp-----------
#include <iostream>
#include <unistd.h>
#include <mk4.h>
void ShowMemoryInfo(){ // shows some lines of /proc information
pid_t id = getpid();
const long file_name_size = 256;
char file_name[file_name_size];
snprintf( file_name, file_name_size, "/proc/%d/status", id );
FILE* fp = fopen( file_name, "r" );
if ( fp == NULL )
{
std::cout << "cannot open file ='" << file_name << "'" << std::endl;
return;
}
const long line_size = 1024;
char line[line_size];
char* temp;
while ( ! feof( fp ) )
{
temp = fgets( line, line_size, fp );
if ( temp == NULL )
break;
if ( strncasecmp( line, "vm", 2 ) == 0 )
std::cout << " " << line;
}
fclose( fp );
}
int main(int, char**)
{
c4_Storage storage( "test.db", true );
c4_View testview = storage.GetAs("test[id:I,name:S]");;
c4_IntProp id("id");
c4_StringProp name("name");
while (1)
{
ShowMemoryInfo();
int n;
for (int i = 0; i < 10000; i++)
{
n = testview.Add( id[i] + name["Mr. Brown"] );
}
std::cout << "last added row was no. " << n << std::endl;
if ( !storage.Commit() ){
std::cout << "Error by Commit()" << std::endl;
return 1;
}
}
return 0;
}
//-------------------------------------------------
I compile it using
g++ -lmk4 main.cpp
with gcc 3.2.2 and Metakit 2.4.9.3 on RedHat Linux 9.
The output looks like this:
VmSize: 2488 kB
VmLck: 0 kB
VmRSS: 968 kB
VmData: 52 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 9999
VmSize: 2968 kB
VmLck: 0 kB
VmRSS: 1384 kB
VmData: 408 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 19999
VmSize: 3472 kB
VmLck: 0 kB
VmRSS: 1644 kB
VmData: 668 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 29999
VmSize: 3768 kB
VmLck: 0 kB
VmRSS: 1648 kB
VmData: 672 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 39999
VmSize: 4284 kB
VmLck: 0 kB
VmRSS: 1772 kB
VmData: 796 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 49999
VmSize: 4844 kB
VmLck: 0 kB
VmRSS: 1844 kB
VmData: 868 kB
VmStk: 8 kB
VmExe: 8 kB
VmLib: 2364 kB
last added row was no. 59999
and goes on with increasing RSS and Data sizes forever. It looks like a
memory leak to me.
Am I doing anything wrong?
Bernhard
_____________________________________________
Metakit mailing list - [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit