mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 07:46:42 +00:00
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:
parent
4e8d0618bb
commit
8afcbce01e
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user