browser
browser copied to clipboard
libdom: unref nodes and strings
netsurf/libdom uses a ref counter to track node and string usage an cleanup memory once the ref count reach 0.
see:
- https://github.com/Browsercore/libdom/blob/master/include/dom/core/string.h#L35-L41
- https://github.com/Browsercore/libdom/blob/master/include/dom/core/node.h#L195-L202
We have to ensure our usages of strings and nodes unref correctly once they are done.
To help detect string leak, we can USS a leak detector the same way netsurf does in its example: https://github.com/Browsercore/libdom/blob/master/examples/dom-structure-dump.c#L372