1 | #include <boost/interprocess/streams/bufferstream.hpp>
|
---|
2 | #include <iostream>
|
---|
3 |
|
---|
4 | template<typename T>
|
---|
5 | inline void leak_check()
|
---|
6 | {
|
---|
7 | std::cout << typeid(T).name() << std::endl;
|
---|
8 |
|
---|
9 | for (int ii=0; ii < 10; ++ii)
|
---|
10 | {
|
---|
11 | const std::size_t size = 80;
|
---|
12 | char buf[size];
|
---|
13 |
|
---|
14 | T log(buf, size-1);
|
---|
15 | (void)log;
|
---|
16 |
|
---|
17 | int* ptr = new int(0);
|
---|
18 | std::cout << ptr << std::endl;
|
---|
19 | delete ptr;
|
---|
20 | }
|
---|
21 |
|
---|
22 | std::cout << std::endl;
|
---|
23 | }
|
---|
24 |
|
---|
25 | int main()
|
---|
26 | {
|
---|
27 | leak_check<boost::interprocess::ibufferstream>();
|
---|
28 | leak_check<boost::interprocess::obufferstream>();
|
---|
29 | leak_check<boost::interprocess::bufferstream>();
|
---|
30 | }
|
---|