Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/hx/GC.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ extern int gPauseForCollect;


// Minimum total memory - used + buffer for new objects
extern int sgMinimumWorkingMemory;
extern size_t sgMinimumWorkingMemory;

// Minimum free memory - not counting used memory
extern int sgMinimumFreeSpace;
extern size_t sgMinimumFreeSpace;

// Also ensure that the free memory is larger than this amount of used memory
extern int sgTargetFreeSpacePercentage;
Expand Down
12 changes: 6 additions & 6 deletions src/hx/gc/GcCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ extern void __hxt_new_string(void* result, int size);
namespace hx
{
#if defined(HX_MACOS) || defined(HX_WINDOWS) || defined(HX_LINUX) || defined(__ORBIS__)
int sgMinimumWorkingMemory = 20*1024*1024;
int sgMinimumFreeSpace = 10*1024*1024;
size_t sgMinimumWorkingMemory = 20*1024*1024;
size_t sgMinimumFreeSpace = 10*1024*1024;
#else
int sgMinimumWorkingMemory = 8*1024*1024;
int sgMinimumFreeSpace = 4*1024*1024;
size_t sgMinimumWorkingMemory = 8*1024*1024;
size_t sgMinimumFreeSpace = 4*1024*1024;
#endif
// Once you use more than the minimum, this kicks in...
int sgTargetFreeSpacePercentage = 100;
Expand All @@ -48,15 +48,15 @@ void CommonInitAlloc()
const char *minimumWorking = getenv("HXCPP_MINIMUM_WORKING_MEMORY");
if (minimumWorking)
{
int mem = atoi(minimumWorking);
size_t mem = strtoull(minimumWorking, 0, 10);
if (mem>0)
sgMinimumWorkingMemory = mem;
}

const char *minimumFreeSpace = getenv("HXCPP_MINIMUM_FREE_SPACE");
if (minimumFreeSpace)
{
int mem = atoi(minimumFreeSpace);
size_t mem = strtoull(minimumFreeSpace, 0, 10);
if (mem>0)
sgMinimumFreeSpace = mem;
}
Expand Down
6 changes: 3 additions & 3 deletions src/hx/gc/Immix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3543,11 +3543,11 @@ class GlobalAllocator
#if defined(SHOW_MEM_EVENTS_VERBOSE) || defined(SHOW_FRAGMENTATION_BLOCKS)
if (inJustBorrowing)
{
GCLOG("Borrow Blocks %d = %d k\n", mAllBlocks.size(), (mAllBlocks.size() << IMMIX_BLOCK_BITS)>>10);
GCLOG("Borrow Blocks %d = %d k\n", mAllBlocks.size(), (int)(GetWorkingMemory() >> 10));
}
else
{
GCLOG("Blocks %d = %d k\n", mAllBlocks.size(), (mAllBlocks.size() << IMMIX_BLOCK_BITS)>>10);
GCLOG("Blocks %d = %d k\n", mAllBlocks.size(), (int)(GetWorkingMemory() >> 10));
}
#endif

Expand Down Expand Up @@ -5235,7 +5235,7 @@ class GlobalAllocator
#endif

// Large alloc target
int blockSize = mAllBlocks.size()<<IMMIX_BLOCK_BITS;
size_t blockSize = GetWorkingMemory();
if (blockSize > mLargeAllocSpace)
mLargeAllocSpace = blockSize;
mLargeAllocForceRefresh = mLargeAllocated + mLargeAllocSpace;
Expand Down