Opened 9 years ago

Closed 9 years ago

#8557 closed Bugs (invalid)

VIRT Memory so much!

Reported by: lucybird@… Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.53.0 Severity: Problem
Keywords: thread memory Cc:

Description

#include <boost/thread/thread.hpp>

#include <boost/thread/mutex.hpp>

#include <boost/bind.hpp>

#include <iostream>

boost::mutex io_mutex;

void count(int id) {

for (int i = 0; i < 10000; ++i) {

boost::mutex::scoped_lock lock(io_mutex);

std::cout << id << ": " << i << std::endl;

boost::this_thread::sleep( boost::posix_time::milliseconds( 1 * 1000 ) );

}

}

int main(int argc, char* argv[]) {

boost::thread thrd1(boost::bind(&count, 1));

boost::thread thrd2(boost::bind(&count, 2));

thrd1.join();

thrd2.join();

return 0;

}

ubuntu server 12.04 x64 kernel 3.5.0-27-generic

VIRT Momory use 164m, too much than ubuntu server 10.04 x64

Change History (6)

comment:1 by viboes, 9 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

What is the problem you want we solve? Do you get the same using pthreads? If , not how do you reduce this consumption?

Last edited 9 years ago by viboes (previous) (diff)

comment:2 by anonymous, 9 years ago

When create one thead use VIRT memory:

Ubuntu server 12.04 x64, pthread_create, Less 1M

Ubuntu server 10.04 x64, boost::thread, About 10M

Ubuntu server 12.04 x64, boost::thread, About 80M

When I use ‘boost:thread’ create more than 1000 threads, About 80G VIRT memory, how can I solve it?

comment:3 by viboes, 9 years ago

It would be useful if you can provide a program that shows this and try it on other versions of Boost and see if this is a regression on Boost.Thread or a regression on how Boost Thread uses Ubuntu resources.

Last edited 9 years ago by viboes (previous) (diff)

comment:4 by viboes, 9 years ago

Milestone: Boost 1.54.0To Be Determined

comment:5 by viboes, 9 years ago

Do you have ciphers for Ubuntu server 10.04 x64, pthread_create?

comment:6 by viboes, 9 years ago

Resolution: invalid
Status: assignedclosed

I can not do anything if you don't collaborate.

Note: See TracTickets for help on using tickets.