KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Heap is a lot larger than used, how to find the cause? Re: Heap is a lot larger than used, how to find the cause?

  • nick_mospan

    Member
    March 14, 2023 at 12:00 am

    Thanks, I found one of the causes – code that brings and refreshes a large table from another process.

    I’m starting a fresh process and bringing in a table of 107Mb. The heap settles to 268Mb after .Q.gc[].

    However after updating this table the heap jumps up to 469Mb and stays there.

    What’s different between the first and second call to position:h”position” ? Why the heap does not go back to the initial 268Mb?

    Here’s the console output:

    q).Q.w[] 
    used| 360512 
    heap| 67108864 
    peak| 67108864 
    wmax| 0 
    mmap| 0 
    mphy| 34359267328 
    syms| 686 
    symw| 37328 
    
    q)position:h"position" 
    q).Q.w[] 
    used| 226930848 
    heap| 402653184 
    peak| 402653184 
    wmax| 0 
    mmap| 0 
    mphy| 34359267328 
    syms| 1833 
    symw| 95932 
    
    q).Q.gc[] 
    134217728 
    
    q).Q.w[] 
    used| 226930848 
    heap| 268435456 
    peak| 402653184 
    wmax| 0 
    mmap| 0 
    mphy| 34359267328 
    syms| 1834 
    symw| 95962 
    
    q)position:h"position" 
    q).Q.gc[] 
    134217728 
    
    q).Q.w[] 
    used| 226933216 
    heap| 469762048 
    peak| 603979776 
    wmax| 0 
    mmap| 0 
    mphy| 34359267328 
    syms| 1834 
    symw| 95962 
    
    q).Q.gc[] 
    0 
    
    q)count position 
    276765 
    
    q)-22!position 
    107637762