Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_io
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_io
Commits
636fdc90
Commit
636fdc90
authored
7 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Fixing graph ML writer leaks
parent
3e91b83c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/GraphMLWriter/GraphMLWriter.hpp
+37
-8
37 additions, 8 deletions
src/GraphMLWriter/GraphMLWriter.hpp
with
37 additions
and
8 deletions
src/GraphMLWriter/GraphMLWriter.hpp
+
37
−
8
View file @
636fdc90
...
@@ -62,6 +62,9 @@ struct vertex_prop
...
@@ -62,6 +62,9 @@ struct vertex_prop
//! Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
/*! \brief Constructor
*
*
* Create a vertex properties list
* Create a vertex properties list
...
@@ -92,13 +95,18 @@ struct vertex_prop
...
@@ -92,13 +95,18 @@ struct vertex_prop
// Create default property names
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
// Create default property names
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
};
};
//! destructor
//! destructor
~
vertex_prop
()
{
delete
[]
attributes_names
;}
~
vertex_prop
()
{
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! It call the functor for each member
/*! It call the functor for each member
*
*
...
@@ -162,6 +170,9 @@ struct vertex_node
...
@@ -162,6 +170,9 @@ struct vertex_node
//! Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
/*! \brief Constructor
*
*
* Create a vertex node
* Create a vertex node
...
@@ -207,6 +218,7 @@ struct vertex_node
...
@@ -207,6 +218,7 @@ struct vertex_node
// Create default property names
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
attributes_names
=
new
std
::
string
[
G
::
V_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
// Create default property names
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
create_prop
<
typename
G
::
V_type
>
(
attributes_names
);
...
@@ -214,7 +226,8 @@ struct vertex_node
...
@@ -214,7 +226,8 @@ struct vertex_node
inline
~
vertex_node
()
inline
~
vertex_node
()
{
{
delete
[]
attributes_names
;
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
}
#ifdef DEBUG
#ifdef DEBUG
...
@@ -308,6 +321,9 @@ struct edge_prop
...
@@ -308,6 +321,9 @@ struct edge_prop
//! Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
/*! \brief Constructor
*
*
* Create an edge properties list
* Create an edge properties list
...
@@ -339,14 +355,17 @@ struct edge_prop
...
@@ -339,14 +355,17 @@ struct edge_prop
// Create default property names
// Create default property names
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
// Create default property names
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
};
};
//! destructor
inline
~
edge_prop
()
~
edge_prop
()
{
{
delete
[]
attributes_names
;}
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! \brief It call the functor for each member
/*! \brief It call the functor for each member
*
*
...
@@ -405,6 +424,9 @@ struct edge_node
...
@@ -405,6 +424,9 @@ struct edge_node
//! Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int
n_attr
=
0
;
int
n_attr
=
0
;
//! indicate if attributes_names is to destroy
bool
to_destroy
=
false
;
/*! \brief Constructor
/*! \brief Constructor
*
*
* Create an edge node
* Create an edge node
...
@@ -437,12 +459,19 @@ struct edge_node
...
@@ -437,12 +459,19 @@ struct edge_node
// Create a number of default properties name
// Create a number of default properties name
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
attributes_names
=
new
std
::
string
[
G
::
E_type
::
max_prop
];
to_destroy
=
true
;
// Create default property names
// Create default property names
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
create_prop
<
typename
G
::
E_type
>
(
attributes_names
);
};
};
inline
~
edge_node
()
{
if
(
to_destroy
==
true
)
{
delete
[]
attributes_names
;}
}
/*! \brief Create a new node
/*! \brief Create a new node
*
*
* \param v_c node number
* \param v_c node number
...
@@ -530,7 +559,7 @@ class GraphMLWriter
...
@@ -530,7 +559,7 @@ class GraphMLWriter
vertex_prop
<
Graph
>
vp
(
v_out
);
vertex_prop
<
Graph
>
vp
(
v_out
);
// Iterate through all the vertex and create the vertex list
// 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 the vertex properties string
return
v_out
;
return
v_out
;
...
@@ -552,7 +581,7 @@ class GraphMLWriter
...
@@ -552,7 +581,7 @@ class GraphMLWriter
edge_prop
<
Graph
>
ep
(
e_out
);
edge_prop
<
Graph
>
ep
(
e_out
);
// Iterate through all the vertex and create the vertex list
// 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 the edge properties string
return
e_out
;
return
e_out
;
...
@@ -629,7 +658,7 @@ class GraphMLWriter
...
@@ -629,7 +658,7 @@ class GraphMLWriter
en
.
new_node
(
nc
,
it
.
source
(),
it
.
target
());
en
.
new_node
(
nc
,
it
.
source
(),
it
.
target
());
// Iterate through all the edges and create the edge list
// 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
// end new node
en
.
end_node
();
en
.
end_node
();
...
...
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