Skip to content

Commit

Permalink
fix test script + additional assert + fix alignment test
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyMakeev committed Oct 9, 2023
1 parent 5c6ef5a commit 8937410
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: CMake Configure
run: mkdir build && cd build && cmake ..
- name: Build
run: cd build && cmake --build . --config Release
run: cd build && cmake --build . --config RelWithDebInfo
- name: Run unit tests
run: cd build && ./smmalloc_test
- name: Run performance tests
Expand All @@ -39,8 +39,8 @@ jobs:
- name: CMake Configure
run: mkdir build && cd build && cmake ..
- name: Build
run: cd build && cmake --build . --config Release
run: cd build && cmake --build . --config RelWithDebInfo
- name: Run unit tests
run: "build/Release/smmalloc_test.exe"
run: "build/RelWithDebInfo/smmalloc_test.exe"
- name: Run performance tests
run: "build/Release/smmalloc_perf.exe"
run: "build/RelWithDebInfo/smmalloc_perf.exe"
1 change: 1 addition & 0 deletions SmMalloc/smmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ class Allocator
const size_t maxBucketIndex = Min(bucketsCount, bucketIndex + 4);
while (bucketIndex < maxBucketIndex)
{
SM_ASSERT(bucketIndex < buckets.size());
void* pRes = buckets[bucketIndex].Alloc();
if (pRes)
{
Expand Down
6 changes: 6 additions & 0 deletions smmalloc_test01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ TEST(SimpleTests, AlignmentTest03)
{
void* p = _sm_malloc(heap, blockSize, alignment);
ASSERT_TRUE(IsAligned(p, alignment));

if (_sm_mbucket(heap, p) == -1)
{
// we've saturated smmalloc all other allocations will be served with default alloc
break;
}
}

_sm_allocator_thread_cache_destroy(heap);
Expand Down

0 comments on commit 8937410

Please sign in to comment.