Skip to content

Commit 15ed069

Browse files
committed
Remove commented code.
1 parent 9fcfda9 commit 15ed069

1 file changed

Lines changed: 0 additions & 84 deletions

File tree

test/managed_heap_memory_test.cpp

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -141,87 +141,3 @@ int main ()
141141
#endif
142142
return 0;
143143
}
144-
145-
/*
146-
//////////////////////////////////////////////////////////////////////////////
147-
//
148-
// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost
149-
// Software License, Version 1.0. (See accompanying file
150-
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
151-
//
152-
// See http://www.boost.org/libs/interprocess for documentation.
153-
//
154-
//////////////////////////////////////////////////////////////////////////////
155-
156-
#include <boost/interprocess/detail/workaround.hpp>
157-
//[doc_managed_heap_memory
158-
#include <boost/container/list.hpp>
159-
#include <boost/interprocess/managed_heap_memory.hpp>
160-
#include <boost/interprocess/allocators/allocator.hpp>
161-
#include <cstddef>
162-
163-
using namespace boost::interprocess;
164-
typedef boost::container::list<int, allocator<int, managed_heap_memory::segment_manager> >
165-
MyList;
166-
167-
int main ()
168-
{
169-
//We will create a buffer of 1000 bytes to store a list
170-
managed_heap_memory heap_memory(1000);
171-
172-
MyList * mylist = heap_memory.construct<MyList>("MyList")
173-
(heap_memory.get_segment_manager());
174-
175-
//Obtain handle, that identifies the list in the buffer
176-
managed_heap_memory::handle_t list_handle = heap_memory.get_handle_from_address(mylist);
177-
178-
//Fill list until there is no more memory in the buffer
179-
BOOST_INTERPROCESS_TRY{
180-
while(1) {
181-
mylist->insert(mylist->begin(), 0);
182-
}
183-
}
184-
BOOST_INTERPROCESS_CATCH(const bad_alloc &){
185-
//memory is full
186-
} BOOST_INTERPROCESS_CATCH_END
187-
//Let's obtain the size of the list
188-
MyList::size_type old_size = mylist->size();
189-
//<-
190-
(void)old_size;
191-
//->
192-
193-
//To make the list bigger, let's increase the heap buffer
194-
//in 1000 bytes more.
195-
heap_memory.grow(1000);
196-
197-
//If memory has been reallocated, the old pointer is invalid, so
198-
//use previously obtained handle to find the new pointer.
199-
mylist = static_cast<MyList *>
200-
(heap_memory.get_address_from_handle(list_handle));
201-
202-
//Fill list until there is no more memory in the buffer
203-
BOOST_INTERPROCESS_TRY{
204-
while(1) {
205-
mylist->insert(mylist->begin(), 0);
206-
}
207-
}
208-
BOOST_INTERPROCESS_CATCH(const bad_alloc &){
209-
//memory is full
210-
} BOOST_INTERPROCESS_CATCH_END
211-
212-
//Let's obtain the new size of the list
213-
MyList::size_type new_size = mylist->size();
214-
//<-
215-
(void)new_size;
216-
//->
217-
218-
assert(new_size > old_size);
219-
220-
//Destroy list
221-
heap_memory.destroy_ptr(mylist);
222-
223-
return 0;
224-
}
225-
//]
226-
*/
227-

0 commit comments

Comments
 (0)