MMGR Questions, code use and thread-saftey
Posted
by
chadb
on Stack Overflow
See other posts from Stack Overflow
or by chadb
Published on 2011-02-24T19:08:59Z
Indexed on
2011/02/25
15:25 UTC
Read the original article
Hit count: 219
1) Is MMGR thread safe?
2) I was hoping someone could help me understand some code. I am looking at something where a macro is used, but I don't understand the macro. I know it contains a function call and an if check, however, the function is a void function. How does wrapping "(m_setOwner (FILE,_LINE_,FUNCTION),false)" ever change return types?
#define someMacro (m_setOwner(__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new ...
void m_setOwner(const char *file, const unsigned int line, const char *func);
3) What is the point of the reservoir?
4) On line 770 ("void *operator new(size_t reportedSize)" there is the line "// ANSI says: allocation requests of 0 bytes will still return a valid value"
Who/what is ANSI in this context? Do they mean the standards?
5) This is more of C++ standards, but where does "reportedSize" come from for "void *operator new(size_t reportedSize)"?
6) Is this the code that is actually doing the allocation needed? "au->actualAddress = malloc(au->actualSize);"
© Stack Overflow or respective owner