How to limit memory of a OS X program? ulimit -v neither -m are working

You can’t. Apple can (using the ledger() system call, which is private), but you can’t. I’m not entirely sure whether launchd’s options work or not – certainly if it was still using the code visible in the last open source version (from 10.9.5), it wouldn’t, because it calls setrlimit(), but it’s been substantially rewritten since … Read more

Virtual method tables

The “virtual function table” or “virtual method table” is a list of method pointers that each class has. It contains pointers to the virtual methods in the class. Each instance of a class has a pointer to the table, which is used when you call a virtual method from the instance. This is because a … Read more

Print address of virtual member function

Currently there is no standard way of doing this in C++ although the information must be available somewhere. Otherwise, how could the program call the function? However, GCC provides an extension that allows us to retrieve the address of a virtual function: void (A::*mfp)() = &A::func; printf(“address: %p”, (void*)(b->*mfp)); …assuming the member function has the … Read more