J
Jan Bielawski
I have a multi-platform STL question (multi-platform means Windows 32,
64, Linux 64-bit, Mac OS). I'd like for an STL vector to return the
memory to the OS - not just to the heap - upon deallocation, like
exiting the scope. I wrote an allocator with the usual :perator
delete in its deallocate() function:
void deallocate(pointer p, size_type num) {
:perator delete((void *)p);
}
....but this does not necessarily return the memory to the OS. I found
the function _heapmin() on MSDN web site and it seems to work for
Windows XP 32-bit:
void deallocate(pointer p, size_type num) {
:perator delete((void *)p);
#ifdef WIN32
_heapmin(); // memory goes away stepping past this line
#endif
}
My first question is: is this the way to go about it in general? And
if yes, what are the corresponding system calls for Linux and Mac?
Finally, is there a newsgroup more suited for this type of question?
Thanks!
64, Linux 64-bit, Mac OS). I'd like for an STL vector to return the
memory to the OS - not just to the heap - upon deallocation, like
exiting the scope. I wrote an allocator with the usual :perator
delete in its deallocate() function:
void deallocate(pointer p, size_type num) {
:perator delete((void *)p);
}
....but this does not necessarily return the memory to the OS. I found
the function _heapmin() on MSDN web site and it seems to work for
Windows XP 32-bit:
void deallocate(pointer p, size_type num) {
:perator delete((void *)p);
#ifdef WIN32
_heapmin(); // memory goes away stepping past this line
#endif
}
My first question is: is this the way to go about it in general? And
if yes, what are the corresponding system calls for Linux and Mac?
Finally, is there a newsgroup more suited for this type of question?
Thanks!