You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a system that captures images every N seconds and updates both the Point Cloud (PCL) and Mesh objects. It’s a multi-threaded system. A new PCL is built from each image, and two mesh objects are merged in a daemon thread.
I’m encountering an issue with RAM not being properly freed after several iterations of this process.
To investigate further, I created a minimal Python script that simply loads a PCL object from a file while monitoring RAM usage using the psutil package. I was able to reproduce the problem with this script.
I also came across several related questions on GitHub discussing similar issues, including potential problems with using threads while loading DLL packages (e.g., ref1 ,ref2).
Questions:
Can you please confirm whether this is a known issue?
Do you have any suggested workarounds?
Steps to reproduce the bug
importpsutilimportgcimportthreadingimportopen3daso3ddefmonitor_ram_usage(interval=5.0, duration=100):
process=psutil.Process(os.getpid())
start_time=time.time()
whileTrue:
# Get memory info for the processmem_info=process.memory_info()
# Convert to MB for better readabilityrss_mb=mem_info.rss/ (1024*1024)
vms_mb=mem_info.vms/ (1024*1024)
print(f"RAM Usage - RSS: {rss_mb:.2f} MB, VMS: {vms_mb:.2f} MB")
last_ram_val=rss_mb# Check if monitoring duration has been reachedifdurationand (time.time() -start_time>=duration):
print("Monitoring complete.")
breaktime.sleep(interval)
pcls= []
lock=threading.Lock()
defload_pcl():
ply_point_cloud=o3d.data.PLYPointCloud()
withlock:
pcls.append(o3d.io.read_point_cloud(ply_point_cloud.path))
monitor_thread=threading.Thread(
target=monitor_ram_usage,
kwargs={"interval": 1, "duration": 501},
daemon=True# Thread will terminate when main program exits
)
monitor_thread.start()
foriinrange(500):
print("loading_another_pcl")
threading.Thread(target=load_pcl, daemon=True).start()
time.sleep(1)
withlock:
print(f"number of pcl loaded {len(pcls)}")
ifi%50==1:
withlock:
delpclspcls= []
gc.collect()
Error message
No response
Expected behavior
I start with a RAM usage of around 325 MB. During the first 50 iterations, each PCL object adds approximately 14 MB. After 50 iterations, the memory usage reaches about 1000 MB. Even after explicitly triggering garbage collection, the RAM usage only drops to 640 MB - not back to the original 325 MB - indicating a potential memory leak or lingering memory usage.
Open3D, Python and System information
- Operating system: Ubuntu 20.04
- Python version: Python 3.11
- Open3D version: 0.19.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
Additional information
No response
The text was updated successfully, but these errors were encountered:
avizipi
changed the title
Summarize the bug (e.g., "Segmentation Fault for Colored Point Cloud Registration")
RAM issue while loading several PCL in threads
Apr 7, 2025
Checklist
main
branch).Describe the issue
I have a system that captures images every N seconds and updates both the Point Cloud (PCL) and Mesh objects. It’s a multi-threaded system. A new PCL is built from each image, and two mesh objects are merged in a daemon thread.
I’m encountering an issue with RAM not being properly freed after several iterations of this process.
To investigate further, I created a minimal Python script that simply loads a PCL object from a file while monitoring RAM usage using the
psutil
package. I was able to reproduce the problem with this script.I also came across several related questions on GitHub discussing similar issues, including potential problems with using threads while loading DLL packages (e.g., ref1 ,ref2).
Questions:
Can you please confirm whether this is a known issue?
Do you have any suggested workarounds?
Steps to reproduce the bug
Error message
No response
Expected behavior
I start with a RAM usage of around 325 MB. During the first 50 iterations, each PCL object adds approximately 14 MB. After 50 iterations, the memory usage reaches about 1000 MB. Even after explicitly triggering garbage collection, the RAM usage only drops to 640 MB - not back to the original 325 MB - indicating a potential memory leak or lingering memory usage.
Open3D, Python and System information
Additional information
No response
The text was updated successfully, but these errors were encountered: