HTML rendering (the first phase of HTML-to-PDF conversion) is a resource consuming task – you know that from your everyday browsing experience: a bulky web page rendering can “eat” all available RAM and block even a native web browser and slow down the system. HTML renderer instantiates a set of objects even for any standalone whitespace. Almost all allocated RAM is released after PD4ML object is garbage collected.
There is only exception (I guess, you see it as a “memory leak”) is a resource caching. The cache (static Map object) holds soft references to loaded resource byte arrays (images, stylesheets etc), which are to be auto-deleted when JVM is short of RAM. You may force the resource releasing by pd4ml.clearCache() API call.