Partial fix to support applications that mix different heaps.