X-Git-Url: http://git.mutantstargoat.com?p=winnie;a=blobdiff_plain;f=src%2Fshalloc.cc;fp=src%2Fshalloc.cc;h=d8f97dc508bbeb29d77d6441da65d21e838500ae;hp=0000000000000000000000000000000000000000;hb=12274901ac01898b01b93e15b5b87dec3348afae;hpb=fd0b93374d8e5a49c16b5e9fe5a0468d00a21c36 diff --git a/src/shalloc.cc b/src/shalloc.cc new file mode 100644 index 0000000..d8f97dc --- /dev/null +++ b/src/shalloc.cc @@ -0,0 +1,29 @@ +#include +#include + +#include "shalloc.h" + +#define POOL_SIZE 16777216 +#define BLOCK_SIZE 1024 + +static unsigned char *pool; +static std::map alloc_sizes; +//address size + +bool init_shared_memory() +{ + if(!(pool = (unsigned char *)malloc(POOL_SIZE))) { + return false; + } +} + +void destroy_shared_memory() +{ + //TODO print statistics + free(pool); +} + +// an zitaei 45 mb 8a vriskw posa blocks kai meta +// 8a psaxnw tosa sunexomena bits sto bitmap +// an den exei return 0 +// pool[arxidi]