seoul: implement heap_free

Avoids the message

cxx: operator delete (void *) called - not implemented. A working implementation is available in the 'stdcxx' library

during a " new ..." which causes exceptions. Happens for seoul in disk.cc

Issue #806
This commit is contained in:
Alexander Boettcher 2013-06-16 15:02:50 +02:00 committed by Norman Feske
parent 4e8d0618bb
commit 8afcbce01e
2 changed files with 16 additions and 3 deletions

View File

@ -82,7 +82,7 @@ void Logging::panic(const char *format, ...)
}
void *heap_alloc(size_t size)
static void *heap_alloc(size_t size)
{
void *res = Genode::env()->heap()->alloc(size);
if (res)
@ -92,6 +92,16 @@ void *heap_alloc(size_t size)
Genode::sleep_forever();
}
static void heap_free(void * ptr)
{
if (Genode::env()->heap()->need_size_for_free()) {
PWRN("leaking memory");
return;
}
Genode::env()->heap()->free(ptr, 0);
}
void *operator new[](size_t size)
{
@ -129,6 +139,11 @@ void operator delete[](void *ptr)
PWRN("delete[] not implemented");
}
void operator delete (void * ptr)
{
heap_free(ptr);
}
void do_exit(char const *msg)
{

View File

@ -16,8 +16,6 @@ struct Aligned {
Aligned(size_t alignment) : alignment(alignment) {}
};
void *heap_alloc(size_t size);
void *operator new[](size_t size);
void *operator new[](size_t size, Aligned const alignment);