Address sanitizer use a lot of memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Address sanitizer use a lot of memory with pthread of this code:
---
#include <vector>
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;

void thread_main(int thread_id) {
	cout << thread_id << endl;
	this_thread::sleep_for(chrono::milliseconds(5000));
}

int main() {
	vector<shared_ptr<thread>> thread_list;
	for (int i=0; i<200; i++) {
		thread_list.push_back(make_shared<thread>(thread_main, i));
	}
	for (auto t: thread_list) {
		t->join();
	}
	thread_list.clear();
	return 0;
}
---
before add -fsanitize=address it used 1.6mb, after add it used 270.5mb.
this code just simply create 200 threads, I have no idea why it will use so much.

GCC version is "gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)",
from rhel 6 devtoolset.
Please let me known if you found anything about this, thanks.

regard.
---
ownssh
ownsshaim@xxxxxxx






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux