forked from Telodendria/Telodendria
Tune the memory table size a little bit.
No idea if this hurts or helps, actually, but now we have a tunable constant, instead of a magic number.
This commit is contained in:
parent
a8beded518
commit
84abff7fb8
2 changed files with 8 additions and 2 deletions
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
#include <Memory.h>
|
#include <Memory.h>
|
||||||
|
|
||||||
|
#include <Constants.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -56,7 +58,7 @@ MemoryInsert(MemoryInfo * a)
|
||||||
|
|
||||||
if (!allocations)
|
if (!allocations)
|
||||||
{
|
{
|
||||||
allocationsSize = 64;
|
allocationsSize = TELODENDRIA_MEMORY_TABLE_CHUNK;
|
||||||
allocations = calloc(allocationsSize, sizeof(void *));
|
allocations = calloc(allocationsSize, sizeof(void *));
|
||||||
if (!allocations)
|
if (!allocations)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +72,7 @@ MemoryInsert(MemoryInfo * a)
|
||||||
size_t tmpAllocationsSize = allocationsSize;
|
size_t tmpAllocationsSize = allocationsSize;
|
||||||
MemoryInfo **tmpAllocations;
|
MemoryInfo **tmpAllocations;
|
||||||
|
|
||||||
allocationsSize *= 2;
|
allocationsSize += TELODENDRIA_MEMORY_TABLE_CHUNK;
|
||||||
tmpAllocations = calloc(allocationsSize, sizeof(void *));
|
tmpAllocations = calloc(allocationsSize, sizeof(void *));
|
||||||
|
|
||||||
if (!tmpAllocations)
|
if (!tmpAllocations)
|
||||||
|
|
|
@ -28,4 +28,8 @@
|
||||||
#define TELODENDRIA_STRING_CHUNK 64
|
#define TELODENDRIA_STRING_CHUNK 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TELODENDRIA_MEMORY_TABLE_CHUNK
|
||||||
|
#define TELODENDRIA_MEMORY_TABLE_CHUNK 256
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue