Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_io
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_io
Commits
636fdc90
Commit
636fdc90
authored
Aug 19, 2017
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing graph ML writer leaks
parent
3e91b83c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
8 deletions
+37
-8
src/GraphMLWriter/GraphMLWriter.hpp
src/GraphMLWriter/GraphMLWriter.hpp
+37
-8
No files found.
src/GraphMLWriter/GraphMLWriter.hpp
View file @
636fdc90
...
...
@@ -62,6 +62,9 @@ struct vertex_prop
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
*
* Create a vertex properties list
...
...
@@ -92,13 +95,18 @@ struct vertex_prop
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
};
//! destructor
~
vertex_prop
()
{
delete
[]
attributes_names
;}
~
vertex_prop
()
{
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! It call the functor for each member
*
...
...
@@ -162,6 +170,9 @@ struct vertex_node
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
*
* Create a vertex node
...
...
@@ -207,6 +218,7 @@ struct vertex_node
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
...
...
@@ -214,7 +226,8 @@ struct vertex_node
inline
~
vertex_node
()
{
delete
[]
attributes_names
;
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
#ifdef DEBUG
...
...
@@ -308,6 +321,9 @@ struct edge_prop
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
*
* Create an edge properties list
...
...
@@ -339,14 +355,17 @@ struct edge_prop
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
};
//! destructor
~
edge_prop
()
{
delete
[]
attributes_names
;}
inline
~
edge_prop
()
{
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! \brief It call the functor for each member
*
...
...
@@ -405,6 +424,9 @@ struct edge_node
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
*
* Create an edge node
...
...
@@ -437,12 +459,19 @@ struct edge_node
// Create a number of default properties name
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
};
inline
~
edge_node
()
{
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! \brief Create a new node
*
* \param v_c node number
...
...
@@ -530,7 +559,7 @@ class GraphMLWriter
vertex_prop
<
Graph
>
vp
(
v_out
);
// Iterate through all the vertex and create the vertex list
boost
::
mpl
::
for_each
<
typename
Graph
::
V_type
::
type
>
(
vp
);
boost
::
mpl
::
for_each
_ref
<
typename
Graph
::
V_type
::
type
>
(
vp
);
// return the vertex properties string
return
v_out
;
...
...
@@ -552,7 +581,7 @@ class GraphMLWriter
edge_prop
<
Graph
>
ep
(
e_out
);
// Iterate through all the vertex and create the vertex list
boost
::
mpl
::
for_each
<
typename
Graph
::
E_type
::
type
>
(
ep
);
boost
::
mpl
::
for_each
_ref
<
typename
Graph
::
E_type
::
type
>
(
ep
);
// return the edge properties string
return
e_out
;
...
...
@@ -629,7 +658,7 @@ class GraphMLWriter
en
.
new_node
(
nc
,
it
.
source
(),
it
.
target
());
// Iterate through all the edges and create the edge list
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
E_type
::
max_prop
>
>
(
en
);
boost
::
mpl
::
for_each
_ref
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
E_type
::
max_prop
>
>
(
en
);
// end new node
en
.
end_node
();
...
...
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