[Bioclusters] (no subject)
Dan Bolser
bioclusters@bioinformatics.org
Tue, 30 Mar 2004 22:59:03 +0100 (BST)
Cool!
I get...
Allocated 3083946496 bytes
That's 2941.08 MB.
From my desktop (Mem:1030956k av, Swap:5116692k av)
Allocated 3083945984 bytes
That's 2941.08 MB.
From my xeon (Mem:4124724k av, Swap:2040244k av)
Hmmmm.....
What does it mean?
:)
Thanks,
Dan.
On Tue, 30 Mar 2004, Aaron Darling wrote:
> >
> > Can anyone suggest a smarter testing program (using malloc for
> > example) which can better probe the per process limit?
> >
> > I will give it a google...
> >
>
> Here's a little c++ code I wrote a while back to do exactly that. Give
> it a minute or two and it will have allocated up to the per-process limit.
> Unsure whether it's necessary for your purposes, but it touches each page
> to make sure they're actually allocated.
>
> #include <iostream>
> using namespace std;
>
> int main( void ){
> char* buf;
> unsigned long long size = 1024 * 1024 * 512;
> unsigned long long total_allocation = 0;
> string junk;
> for( int i = 0;; i++ ){
> if( size < 512 )
> break;
> try{
> buf = new char[ size ];
> }catch( exception& e ){
> cerr << "Alloc failed, new size is: " << size / 2 << endl;
> cerr << "total_alloc is: " << total_allocation << endl;
> size /= 2;
> continue;
> }
> total_allocation += size;
> for( unsigned bufI = 0; bufI < size; bufI+= 512 )
> buf[ bufI ] = 0xAA;
> }
> cerr << "Allocated " << total_allocation << " bytes\n";
> cerr << "That's " << (double)total_allocation / (double)(1024 * 1024) << " MB.\n";
> }
>
> _______________________________________________
> Bioclusters maillist - Bioclusters@bioinformatics.org
> https://bioinformatics.org/mailman/listinfo/bioclusters
>