Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
02e31cba
Commit
02e31cba
authored
Jul 11, 2018
by
Etienne Renault
Browse files
bloemen: fix memory leaks
* spot/mc/bloemen.hh, spot/mc/mc.hh: here.
parent
bc5287c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
spot/mc/bloemen.hh
View file @
02e31cba
...
...
@@ -93,7 +93,8 @@ namespace spot
iterable_uf
(
shared_map
&
map
,
unsigned
tid
)
:
map_
(
map
),
tid_
(
tid
),
size_
(
std
::
thread
::
hardware_concurrency
()),
nb_th_
(
std
::
thread
::
hardware_concurrency
()),
inserted_
(
0
)
nb_th_
(
std
::
thread
::
hardware_concurrency
()),
inserted_
(
0
),
p_
(
sizeof
(
uf_element
))
{
}
...
...
@@ -105,7 +106,7 @@ namespace spot
unsigned
w_id
=
(
1U
<<
tid_
);
// Setup and try to insert the new state in the shared map.
uf_element
*
v
=
new
uf_element
();
uf_element
*
v
=
(
uf_element
*
)
p_
.
allocate
();
v
->
st_
=
a
;
v
->
parent
=
v
;
v
->
next_
=
v
;
...
...
@@ -119,7 +120,7 @@ namespace spot
// Insertion failed, delete element
// FIXME Should we add a local cache to avoid useless allocations?
if
(
!
b
)
delete
v
;
p_
.
deallocate
(
v
)
;
else
++
inserted_
;
...
...
@@ -393,6 +394,7 @@ namespace spot
unsigned
size_
;
///< \brief Maximum number of thread
unsigned
nb_th_
;
///< \brief Current number of threads
unsigned
inserted_
;
///< \brief The number of insert succes
fixed_size_pool
<
pool_type
::
Unsafe
>
p_
;
///< \brief The allocator
};
/// \brief This object is returned by the algorithm below
...
...
@@ -461,6 +463,7 @@ namespace spot
todo_
.
push_back
(
w
.
second
);
Rp_
.
push_back
(
w
.
second
);
++
states_
;
sys_
.
recycle
(
it
,
tid_
);
goto
bloemen_recursive_start
;
}
else
if
(
w
.
first
==
uf
::
claim_status
::
CLAIM_FOUND
)
...
...
spot/mc/mc.hh
View file @
02e31cba
...
...
@@ -226,8 +226,10 @@ namespace spot
stats
.
push_back
(
swarmed
[
i
]
->
stats
());
for
(
unsigned
i
=
0
;
i
<
nbth
;
++
i
)
delete
swarmed
[
i
];
{
delete
swarmed
[
i
];
delete
ufs
[
i
];
}
return
std
::
make_pair
(
stats
,
tm
);
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment