1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-24 02:03:52 +03:00

B #6365: Fix mem leak in Scheduler, optimize Cluster construction (#2802)

- Fix memory leak in Scheduler
- Optimize BitMap
This commit is contained in:
Pavel Czerný 2023-11-10 10:34:04 +01:00 committed by GitHub
parent b749757934
commit 4756ef9d1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -137,7 +137,7 @@ public:
{
if ( hint != 0 )
{
if ( bs->test(hint) == false && reserved_bit.count(hint) == 0 )
if ( !bs->test(hint) && !reserved_bit.test(hint) )
{
bs->set(hint);
@ -150,7 +150,7 @@ public:
{
try
{
if ( bs->test(bit) == false && reserved_bit.count(bit) == 0)
if ( !bs->test(bit) && !reserved_bit.test(bit) )
{
bs->set(bit);
return 0;
@ -217,7 +217,7 @@ private:
unsigned int start_bit;
std::set<unsigned int> reserved_bit;
std::bitset<N> reserved_bit;
std::bitset<N> * bs;
@ -365,9 +365,9 @@ private:
continue;
}
for (bit = bit_start; bit <= bit_end; bit++)
for (bit = bit_start; bit <= bit_end && bit < N; bit++)
{
reserved_bit.insert(bit);
reserved_bit.set(bit);
}
}

View File

@ -161,7 +161,7 @@ private:
/**
* The associated vector attribute
*/
VectorAttribute * va;
std::unique_ptr<VectorAttribute> va;
/**
* Set the VMS attribute for the role (list of VM IDs)