[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Need to test mallinfo() on different platforms
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2003-02-25 10:14:42
[Download RAW message or body]

Hello,

 could folks who have access to non-Linux systems please try to compile the 
attached testapp and send me the output, together with the platform 
(preferably specified as what configure reports, i.e. I already have it for
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu ).

 Some platforms will maybe need stdlib.h instead of malloc.h, so just change 
the #if 1 to 0 (and on some it won't compile at all - I'm not interested in 
those).

 Please send the replies directly to me. Thanks.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

["a.cpp" (text/x-c++src)]

#if 1
#include <malloc.h>
#else
#include <stdlib.h>
#endif

#include <iostream>
using namespace std;

void deb( struct mallinfo& m )
    {
    cout << m.hblks << ":" << m.hblkhd << ":" << m.uordblks << ":" << m.usmblks << endl;
    }
    
int main()
    {
    const int SIZE = 4 * 1024 * 1024;
    struct mallinfo m1 = mallinfo();
    void* mem1 = malloc( SIZE );
    struct mallinfo m2 = mallinfo();
    free( mem1 );
    struct mallinfo m3 = mallinfo();
    void* mem2[ SIZE / 32 ];
    for( int i = 0;
	 i < SIZE / 32;
	 ++i )
	mem2[ i ] = malloc( 32 );
    struct mallinfo m4 = mallinfo();
    for( int i = 0;
	 i < SIZE / 32;
	 ++i )
	free( mem2[ i ] );
    struct mallinfo m5 = mallinfo();
    void* mem3[ SIZE / 1024 ];
    for( int i = 0;
	 i < SIZE / 1024;
	 ++i )
	mem3[ i ] = malloc( 1024 );
    struct mallinfo m6 = mallinfo();
    for( int i = 0;
	 i < SIZE / 1024;
	 ++i )
	free( mem3[ i ] );
    struct mallinfo m7 = mallinfo();
    deb( m1 );
    deb( m2 );
    deb( m3 );
    deb( m4 );
    deb( m5 );
    deb( m6 );
    deb( m7 );
    }

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic