Skip to content

Commit

Permalink
Merge pull request #8 from bab2min/dev
Browse files Browse the repository at this point in the history
fixed memory leak
  • Loading branch information
bab2min authored Aug 5, 2020
2 parents 57d1196 + 7ee1961 commit 31d5320
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions EigenRand/PacketRandomEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ namespace Eigen
{
if (memory)
{
for (size_t i = 0; i < length; ++i)
{
aligned[i].~Ty();
}
std::free(memory);
memory = nullptr;
aligned = nullptr;
Expand Down Expand Up @@ -451,6 +455,7 @@ namespace Eigen
{
for (int i = 0; i < num_parallel; ++i)
{
rngs[i].~BaseRng();
new (&rngs[i]) BaseRng{ seed + i * u64_stride };
}
}
Expand All @@ -459,6 +464,7 @@ namespace Eigen
{
for (int i = 0; i < num_parallel; ++i)
{
rngs[i].~BaseRng();
new (&rngs[i]) BaseRng{ o };
}
}
Expand Down

0 comments on commit 31d5320

Please sign in to comment.