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 15, 2023 at 12:00 am

    My table has 54 columns of various simple types, mainly floats, symbols, ints and timestamps. Each column is of around 2Mb in size.

    I can reproduce it with your code by dropping n to 2000000, which makes columns similar in size to my case. .Q.gc[] does not help releasing the excess heap to the OS:

     

    q).Q.w[] 
    used| 50694464 
    heap| 134217728 
    peak| 201326592 
    wmax| 0 
    mmap| 0 
    mphy| 34359267328 
    syms| 696 
    symw| 37613

     

    Each column with n:2000000 should be allocated 16777216 bytes of heap.

     

    q)(-22!) each value flip position 
    16000014 8667837 16000014

     

    What is the reason for such behaviour? Are these columns small enough to lead to memory fragmentation or there’s something else going on?