8000 Clarification on the Usage and Purpose of the `dynamap` Red-Black Tree in Box64 · Issue #2511 · ptitSeb/box64 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Clarification on the Usage and Purpose of the dynamap Red-Black Tree in Box64 #2511
Open
@devarajabc

Description

@devarajabc

While examining Box64's memory management system, particularly the usage of rbtree, I observed unusual behavior involving the dynamap tree. By running Box64 combined with Wine64 on a Windows 64-bit chess game, I noticed that the dynamap tree significantly outnumbers other trees in node count. However, despite the high node usage, nodes from dynamap were rarely (if ever) actively accessed during execution (rb_get, rb_get_64, rb_get_end, rb_get_end_64, rb_get_right or rb_get_left calls).

Image

Additionally, I collected detailed statistics on node creation and usage:
A total of 54,306 rbtree nodes were created during execution.
Only 17,886 nodes were released before the process terminated.

Among the released nodes, the breakdown of unused nodes (i.e., created but never accessed) is as follows:

  1. blockstree: 0 unused nodes
  2. db_sizes: 52 unused nodes
  3. dynamap: 16,697 unused nodes (100% of released dynamap nodes were unused)
  4. envmap: 1 unused node
  5. mapallmem: 158 unused nodes
  6. mapmem: 105 unused nodes
  7. memprot: 873 unused nodes
  8. rbt_dynmem: 0 unused nodes

To further verify this observation, I experimentally disabled the usage of dynamap within the Box64 codebase and repeated my tests. Surprisingly, the system functioned perfectly without noticeable issues.

int rb_set_64(rbtree_t *tree, uintptr_t start, uintptr_t end, uint64_t data) {
    if(!strcmp(“dynamap”, tree->name))
        return 0;
    //--skip--//
}

Image

Given these observations, I seek clarification on the following points:

  1. Intended Purpose: What was the initial purpose behind implementing the dynamap tree within Box64's memory management system?

  2. Node Utilization: Why does dynamap contain so many nodes if these nodes are rarely (or never) accessed during regular operations?

  3. Impact of Removal: Considering that disabling dynamap had no observable negative impact in my tests, could removing or optimizing dynamap improve memory efficiency or overall performance?

Experimental Environment:

  1. Box64 Version: v0.3.5 d3d3fa2 on apr 7
  2. Wine64 Version: wine-9.22
  3. Host System: Raspberry Pi 400 running Linux Debian 6.12.3-arm64 #1 SMP Debian 6.12.3-1 (2024-12-07) aarch64 GNU/Linux
  4. Game Tested: chess
  5. Build Configuration:
cmake \
    -G Ninja \
    -D RPI4ARM64=1 -D ARM_DYNAREC=ON \
    -D CMAKE_BUILD_TYPE=RelWithDebInfo \
    -D CMAKE_C_COMPILER=aarch64-none-linux-gnu-gcc \
    ..
ninja

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0