S
Shayne Wissler
I've overloaded the global new operator, so that I can, detect when I've run
out of memory:
extern void* operator new(size_t s) {
void *r = malloc(s);
if (!r && s) {
fprintf(stderr, "Error: No more memory.");
exit(1);
}
return r;
}
The problem here is that I don't really want to call malloc (and--Valgrind
is quite noisy about me doing this); I want to call the implementation of
new that I overrode. Suggestions?
Thanks,
Shayne Wissler
out of memory:
extern void* operator new(size_t s) {
void *r = malloc(s);
if (!r && s) {
fprintf(stderr, "Error: No more memory.");
exit(1);
}
return r;
}
The problem here is that I don't really want to call malloc (and--Valgrind
is quite noisy about me doing this); I want to call the implementation of
new that I overrode. Suggestions?
Thanks,
Shayne Wissler