Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_devices
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_devices
Commits
4a065a93
Commit
4a065a93
authored
9 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Fixing destroy
parent
6614dc2b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Makefile.am
+1
-1
1 addition, 1 deletion
src/Makefile.am
src/memory/BHeapMemory.hpp
+2
-2
2 additions, 2 deletions
src/memory/BHeapMemory.hpp
src/memory/HeapMemory.cpp
+11
-7
11 additions, 7 deletions
src/memory/HeapMemory.cpp
src/memory/HeapMemory.hpp
+1
-1
1 addition, 1 deletion
src/memory/HeapMemory.hpp
with
15 additions
and
11 deletions
src/Makefile.am
+
1
−
1
View file @
4a065a93
...
...
@@ -22,7 +22,7 @@ libofpmmemory_se2_a_SOURCES = memory/HeapMemory.cpp $(CUDA_SOURCES) memory/PtrMe
libofpmmemory_se2_a_CXXFLAGS
=
$(
INCLUDES_PATH
)
$(
BOOST_CPPFLAGS
)
-I
/usr/local/include
-DSE_CLASS2
libofpmmemory_se2_a_CFLAGS
=
nobase_include_HEADERS
=
memory/ExtPreAlloc.hpp memory/HeapMemory.hpp memory/memory.hpp memory/PreAllocHeapMemory.hpp memory/PtrMemory.hpp
\
nobase_include_HEADERS
=
memory/ExtPreAlloc.hpp
memory/BHeapMemory.hpp
memory/HeapMemory.hpp memory/memory.hpp memory/PreAllocHeapMemory.hpp memory/PtrMemory.hpp
\
Memleak_check.hpp ptr_info.hpp
\
util/se_util.hpp
...
...
This diff is collapsed.
Click to expand it.
src/memory/BHeapMemory.hpp
+
2
−
2
View file @
4a065a93
...
...
@@ -64,7 +64,7 @@ public:
//! Constructor, we choose a default alignment of 32 for avx
BHeapMemory
()
:
HeapMemory
()
:
HeapMemory
()
,
buf_sz
(
0
)
{};
virtual
~
BHeapMemory
()
...
...
@@ -118,7 +118,7 @@ public:
* \return true if the resize operation complete correctly
*
*/
virtual
size_t
size
()
virtual
size_t
size
()
const
{
return
buf_sz
;
}
...
...
This diff is collapsed.
Click to expand it.
src/memory/HeapMemory.cpp
+
11
−
7
View file @
4a065a93
...
...
@@ -67,6 +67,10 @@ void HeapMemory::destroy()
if
(
dmOrig
!=
NULL
)
delete
[]
dmOrig
;
sz
=
0
;
dm
=
NULL
;
dmOrig
=
NULL
;
}
...
...
@@ -166,13 +170,13 @@ size_t HeapMemory::size() const
bool
HeapMemory
::
resize
(
size_t
sz
)
{
// if the allocated memory is enough, do not resize
if
(
sz
<=
size
())
if
(
sz
<=
HeapMemory
::
size
())
return
true
;
//! Allocate the device memory if not done yet
if
(
size
()
==
0
)
return
allocate
(
sz
);
if
(
HeapMemory
::
size
()
==
0
)
return
HeapMemory
::
allocate
(
sz
);
//! Create a new buffer if sz is bigger than the actual size
byte
*
tdm
;
...
...
@@ -192,16 +196,16 @@ bool HeapMemory::resize(size_t sz)
//! copy from the old buffer to the new one
#ifdef SE_CLASS2
check_valid
(
tdm
,
size
());
check_valid
(
dm
,
size
());
check_valid
(
tdm
,
HeapMemory
::
size
());
check_valid
(
dm
,
HeapMemory
::
size
());
#endif
memcpy
(
tdm
,
dm
,
size
());
memcpy
(
tdm
,
dm
,
HeapMemory
::
size
());
this
->
sz
=
sz
;
//! free the old buffer
destroy
();
HeapMemory
::
destroy
();
//! change to the new buffer
...
...
This diff is collapsed.
Click to expand it.
src/memory/HeapMemory.hpp
+
1
−
1
View file @
4a065a93
...
...
@@ -140,7 +140,7 @@ public:
virtual
~
HeapMemory
()
{
if
(
ref_cnt
==
0
)
destroy
();
HeapMemory
::
destroy
();
else
std
::
cerr
<<
"Error: "
<<
__FILE__
<<
" "
<<
__LINE__
<<
" destroying a live object"
<<
"
\n
"
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment