+#define _Noreturn
+
namespace com;
// #define DISABLE_MEMMGR
#endif
#endif
+#if defined(__EMSCRIPTEN__)
+#define GetCurrentThreadID() 0
+#endif
+
// #define MEMINFO
/*
#ifdef MEMINFO
break;
current = current * 3 / 2;
if(current == 1) current = 2;
+ if(current & 7) current += 8 - (current & 7);
}
return pos;
}
{
current = current * 3 / 2;
if(current == 1) current = 2;
+ if(current & 7) current += 8 - (current & 7);
}
return (uint)current;
}
return (uint)current;
current = current * 3 / 2;
if(current == 1) current = 2;
+ if(current & 7) current += 8 - (current & 7);
}
return (uint)current;
}
void * pointer;
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Wait();
#endif
printf(" %s\n", stack.frames[c]);
memoryErrorsCount++;
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
+#endif
return null;
}
}
#endif
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Release();
#endif
#else
void * pointer;
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Wait();
#endif
if(stack.frames[c])
printf(" %s\n", stack.frames[c]);
memoryErrorsCount++;
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
+#endif
return null;
}
}
#endif
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Release();
#endif
#else
if(!size) { _free(pointer); return null; }
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Wait();
#endif
if(stack.frames[c])
printf(" %s\n", stack.frames[c]);
memoryErrorsCount++;
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
+#endif
return null;
}
memset(pointer, 0xAB, REDZONE);
pointer = realloc(pointer, size);
#endif
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Release();
#endif
return pointer ? ((byte *)pointer + REDZONE) : null;
#else
if(!size) { _free(pointer); return null; }
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Wait();
#endif
if(stack.frames[c])
printf(" %s\n", stack.frames[c]);
memoryErrorsCount++;
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
+#endif
return null;
}
memset(pointer, 0xAB, REDZONE);
pointer = crealloc(pointer, size);
#endif
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
memMutex.Release();
#endif
return pointer ? ((byte *)pointer + REDZONE) : null;
#if defined(DISABLE_MEMMGR) && !defined(MEMINFO)
free(pointer);
#else
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
if(memMutex != pointer) memMutex.Wait();
#endif
free(pointer);
#endif
-#if !defined(ECERE_BOOTSTRAP)
+#if !defined(ECERE_BOOTSTRAP) && !defined(__EMSCRIPTEN__)
if(memMutex != pointer) memMutex.Release();
#endif
switch(param.type)
{
case type:
- arg.dataTypeString = CopyString(arg.dataTypeString);
+ // TOFIX: Memory leak here on e.g. registering 'ecere::com::AVLNode<AT>' from ComputeClassParameters(
+ /*
+ if(arg.dataTypeString && !strcmp(arg.dataTypeString, "ecere::com::AVLNode<AT>"))
+ ;
+ else*/
+ arg.dataTypeString = CopyString(arg.dataTypeString);
break;
case expression:
#ifdef MEMINFO
#undef malloc
+#if !defined(__EMSCRIPTEN__)
memMutex.Wait();
+#endif
//allocateClass = _class;
allocateClass = malloc(strlen(_class.name)+1);
allocateInternal = _class.module == __thisModule;
}
#ifdef MEMINFO
allocateClass = null;
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
#endif
+#endif
#if defined(_DEBUG) && !defined(MEMINFO) && defined(MEMTRACKING)
{
blocksByClass.Free();
sizeByClass.Free();
+#if !defined(__EMSCRIPTEN__)
memMutex.Wait();
+#endif
for(p = 0; pools && p < NUM_POOLS; p++)
{
BlockPool * pool = &pools[p];
sizeByClass[c] += block.size;
}
}
+#if !defined(__EMSCRIPTEN__)
memMutex.Release();
+#endif
//for(c : blocksByClass)
{