forked from smistad/OpenCLUtilityLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGarbageCollector.hpp
More file actions
28 lines (23 loc) · 805 Bytes
/
Copy pathGarbageCollector.hpp
File metadata and controls
28 lines (23 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef GARBAGECOLLECTOR_HPP_
#define GARBAGECOLLECTOR_HPP_
#include <boost/shared_ptr.hpp>
#include "CL/OpenCL.hpp"
#include <set>
namespace oul {
/**
* The purpose of the garbage collector object is to allow the explicit deletion
* of OpenCL memory objects such as buffers and images. This is useful when you
* want to delete an OpenCL memory object at a specific location in your code
* instead of waiting for the object to reach the end of its scope.
*/
class GarbageCollector {
public:
void addMemoryObject(cl::Memory *);
void deleteMemoryObject(cl::Memory *);
void deleteAllMemoryObjects();
private:
std::set<cl::Memory *> memoryObjects;
};
typedef boost::shared_ptr<class GarbageCollector> GarbageCollectorPtr;
}
#endif /* GARBAGECOLLECTOR_HPP_ */