Page 1 of 1
delete ? new ??
Posted: Thu Oct 17, 2002 9:58 pm
by gtsphere
well i ran into something i thought i could have gotten around, the new and delete operators... lol
well i need a delete operator, any ideas? i really haven't seen many around to even learn from
thanks in advance soo much!
Re:delete ? new ??
Posted: Fri Oct 18, 2002 1:48 am
by grey wolf
Code: Select all
void operator delete (void* p) { free(p); }
you might need the array variant, but i don't recall the exact code at the moment. of course, replace free() with your kernel's free() function.
Re:delete ? new ??
Posted: Fri Oct 18, 2002 6:07 am
by Tim
Code: Select all
operator new(size_t size)
{
return malloc(size);
}
operator new[](size_t size)
{
return malloc(size);
}
operator delete(void *p)
{
free(p);
}
operator delete[](void *p)
{
free(p);
}
Re:delete ? new ??
Posted: Mon Oct 21, 2002 10:20 pm
by Schol-R-LEA
No offense, Tim, but that answer only helps if Gtsphere has already written a memory mangler and implemented malloc() and free() based on it.
Then again, GTS seems to be OK with this answer (or at least hasn't complained about it), so perhaps he has.
It's issues like this that make me want to use a garbage-collecting system for the code outside of the kernel proper.