Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
880e8ff9
Commit
880e8ff9
authored
Jun 21, 2019
by
Jayaram Bobba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap default allocator in a unique pointer for automatic deallocation
parent
00f79586
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
aligned_buffer.hpp
src/ngraph/runtime/aligned_buffer.hpp
+4
-0
allocator.cpp
src/ngraph/runtime/allocator.cpp
+2
-2
allocator.hpp
src/ngraph/runtime/allocator.hpp
+2
-2
No files found.
src/ngraph/runtime/aligned_buffer.hpp
View file @
880e8ff9
...
...
@@ -50,7 +50,11 @@ private:
AlignedBuffer
(
const
AlignedBuffer
&
)
=
delete
;
AlignedBuffer
&
operator
=
(
const
AlignedBuffer
&
)
=
delete
;
// Allocator objects and the allocation interfaces are owned by the
// creators of AlignedBuffers. They need to ensure that the lifetime of
// m_allocator exceeds the lifetime of this AlignedBuffer.
Allocator
*
m_allocator
;
char
*
m_allocated_buffer
;
char
*
m_aligned_buffer
;
size_t
m_byte_size
;
...
...
src/ngraph/runtime/allocator.cpp
View file @
880e8ff9
...
...
@@ -51,6 +51,6 @@ public:
ngraph
::
runtime
::
Allocator
*
ngraph
::
runtime
::
get_default_allocator
()
{
static
DefaultAllocator
*
allocator
=
new
DefaultAllocator
(
);
return
allocator
;
static
std
::
unique_ptr
<
DefaultAllocator
>
allocator
(
new
DefaultAllocator
()
);
return
allocator
.
get
()
;
}
src/ngraph/runtime/allocator.hpp
View file @
880e8ff9
...
...
@@ -28,8 +28,8 @@ namespace ngraph
{
class
Allocator
;
class
DefaultAllocator
;
/// \brief Returns a
statically allocated default ngraph allocator
//
that calls into system allocation libraries
/// \brief Returns a
pointer to a statically allocated singleton
//
/ allocator
that calls into system allocation libraries
Allocator
*
get_default_allocator
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment