The existing memory usage functions only counted structural overhead
(sizeof of containers and pointers) but missed the actual transaction
and metadata blob sizes. This caused severe underreporting - showing
KBs when actually using MBs or GBs.
Changes:
- Keep existing structural overhead calculations
- Add actual transaction/metadata serialized data sizes
- Use transactionMap_ as single source to avoid double-counting
- Add MAP_NODE_OVERHEAD constant for red-black tree nodes (~40 bytes each)
- Use vector::capacity() instead of size() for actual allocated memory
- Include ledger's transaction map node overhead in ledger calculations
- Change internal calculation to uint64_t to prevent overflow
- Add clear comments explaining what each section measures
These improvements provide much more accurate memory reporting for
monitoring and diagnostic purposes.