Issue
The documentation claims that you can pass a command to psrecord to launch and attach to that process. However, doing so seems to fail and produces different results than if the process is launched in a separate shell and attached to manually.
Environment
Operating System: Linux-5.15.0-91-generic-x86_64-with-glibc2.35
Python Version: 3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0]
psrecord 1.4
psutil 7.0.0
matplotlib 3.10.3
Launching from within a venv virtual environment
Steps to reproduce
memory_eater.py
import time
import tqdm
print("Eating memory")
a = []
for i in tqdm.tqdm(range(10_000)):
a.append([0 for _ in range(i)])
time.sleep(0.001)
print("Done eating memory")
psrecord "python3 memory_eater.py" --log eaterlog.txt
eaterlog.txt
python3 memory_eater.py &
psrecord XXXXXX --log eaterlog_2.txt
eaterlog_2.txt
Issue
The documentation claims that you can pass a command to psrecord to launch and attach to that process. However, doing so seems to fail and produces different results than if the process is launched in a separate shell and attached to manually.
Environment
Operating System:
Linux-5.15.0-91-generic-x86_64-with-glibc2.35Python Version:
3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0]psrecord
1.4psutil
7.0.0matplotlib
3.10.3Launching from within a
venvvirtual environmentSteps to reproduce
memory_eater.py
psrecord "python3 memory_eater.py" --log eaterlog.txteaterlog.txt
python3 memory_eater.py & psrecord XXXXXX --log eaterlog_2.txteaterlog_2.txt