Aspose.Diagram RSS (Resident Set Size) memory is not getting de-allocated post successful procressing

Hi Team,

I am using Aspose.Diagram for Python via .Net with a temporary license. aspose-diagram-python==26.1.
I am calling an API that performs some visio operations and save the file as pdf. The code is running on a ECS container. For each request, memory is getting allocated. But post that processing the memory is not getting released. With every request the memory reservation builds up. This is causing issues when the memory limits are reached.
I have tried garbage collection using gc.collect() and malloc_trim(0). However, the memory leak is still happening.
As can be seen below, Memory usage is still high event though CPU usage has dropped. No requests are being processed at this time:

Also, please find memory stats as below:
sh-4.4$ cat /sys/fs/cgroup/memory/memory.stat
cache 25636864
rss 3410599936
rss_huge 952107008
shmem 0
mapped_file 0
dirty 0
writeback 0
workingset_refault_anon 0
workingset_refault_file 0
swap 0
pgpgin 2313397
pgpgout 1712957
pgfault 2316817
pgmajfault 0
inactive_anon 3432030208
active_anon 36864
inactive_file 17764352
active_file 7872512
unevictable 0
hierarchical_memory_limit 6442450944
hierarchical_memsw_limit 6442450944
total_cache 25636864
total_rss 3410599936
total_rss_huge 952107008
total_shmem 0
total_mapped_file 0
total_dirty 0
total_writeback 0
total_workingset_refault_anon 0
total_workingset_refault_file 0
total_swap 0
total_pgpgin 2313397
total_pgpgout 1712957
total_pgfault 2316817
total_pgmajfault 0
total_inactive_anon 3432030208
total_active_anon 36864
total_inactive_file 17764352
total_active_file 7872512
total_unevictable 0
sh-4.4$ ^C
sh-4.4$
image.png (16.8 KB)

Can you please assist with this?

@Ak78808

I understand that after each request the RSS memory keeps growing and is not released, even though the processing has finished.

To investigate this further, could you provide the following information?

  1. A minimal code snippet that loads a Visio file, performs the required operations, saves it as PDF, and then returns.
  2. Whether you explicitly dispose of the Diagram (or related) objects after processing (e.g., by calling Dispose(), using a using block, or a context manager).
  3. The .NET runtime version (e.g., .NET 6, .NET 7) and the base OS image used inside the ECS container.

With these details we can better determine if the memory is retained due to object lifetimes, runtime behavior, or another factor, and suggest an appropriate solution.

I am not using a Dispose() method or using a context manager. Can you give me a sample code for Python via .NET for reference?

@Ak78808
Thanks for the screenshot.
We are sorry that in the current .NET version there is a dispose method, but in Python via .NET there is not yet.
We plan to support diagram.close in next python via .net version 26.3 which will be released in the first half of March 2026. You will be notified when the next version is released.
Thanks.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMPYTHONNET-142

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.