yahoo / Oak

A Scalable Concurrent Key-Value Map for Big Data Analytics
Apache License 2.0
268 stars 48 forks source link

minor bug fixes and added benchmarks #170

Closed li0nr closed 2 years ago

li0nr commented 3 years ago

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

liran-funaro commented 3 years ago

Thanks @li0nr. Can you please provide an explanation of the bugs that are solved by this PR?

li0nr commented 3 years ago

Sure, line 96 is to have more precise allocated value, since when reallocating from the free list the original code with missing adding the newly allocated bytes to the variable allocated , while it was decreased in the free function.

line 217, is to tackle a highly concurrent allocation consider this scenario a lot of threads want to allocate and we are forced to allocate new block since the getAndIncrement line 216 was before the assignment to the blockArray other threads may allocate from this block but form their perspective the blockArray still at null, so when those threads try to call readMemoryAddress they will get null.