Since you pointed out FreeBSD, the module resourcethat ships with Python (but only works for Unix-y environments) may be useful . In particular, it resource.getrusage(resource.RUSAGE_BOTH)provides you with the use of the resources of this process and all child processes.
It would seem that you would be interested in the following:
ru_maxrss maximum resident set size
ru_ixrss shared memory size
ru_idrss unshared memory size
ru_isrss unshared stack size
source
share