Skip to content

Exclude all profiling memory overhead from heap profile

Profiled builds add an extra 2 words to object headers (because we use StgProfHeader instead of StgSMPThunkHeader). The user guide says that these 2 words are not counted in heap profiles. That seems like the correct/desired behaviour as we don't want those 2 words to distort the heap profile.

There are cases where we do count the extra 2 words in heapCensusChain:

            switch (info->type) {

            case THUNK:
                size = thunk_sizeW_fromITBL(info);
                break;

            case THUNK_1_1:
            case THUNK_0_2:
            case THUNK_2_0:
                size = sizeofW(StgThunkHeader) + 2;
                break;
            ...

where sizeofW(StgThunkHeader) includes the size of the StgProfHeader.

Task: change these cases to exclude the extra 2 words of the profiled build and check other cases in heapCensusChain.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information