dexplo/dataframe_image

Lib uses a lot of memory - RAM

jekeam opened this issue · 3 comments

Hi I am using a script to create a table like this.

I encountered a problem that when several users try to generate a similar table, my server runs out of RAM, one generation consumes a lot of memory, about 1GB, what could be the problem?

photo_2024-05-06_23-44-03

create_img_th = threading.Thread(
    target=dfi.export,
    kwargs={
    "obj": namaz_month_df,
    "filename": temp_path,
    "fontsize": 4,
    "dpi": 800,
    },
)
            create_img_th.start()

The problem is that I have about 4GB, and if 4-5 users make a similar request, my application will crash due to lack of RAM.

A temporary solution is to reduce the DPI=350, but I would like another solution.

Can log memory usage by

ps -eo size,pid,user,command --sort -size | \
    awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
    cut -d "" -f2 | cut -d "-" -f1

Or using top/htop.

@PaleNeutron Yes, I checked this, or do you need some specific data?

Just put the output here. I'll diagnose which process is consuming memory.