This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Memory leak with datetime used with time.strptime
Type: resource usage Stage: resolved
Components: None Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: ggenellina, quentin.gallet-gilles, sebegue, skip.montanaro
Priority: normal Keywords:

Created on 2008-12-10 14:40 by sebegue, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg77543 - (view) Author: BEGUE (sebegue) Date: 2008-12-10 14:40
When I use the following line in my process (my process run these line
each 10 seconds), memory size increases progressively :
myDate = datetime.datetime(*(time.strptime(dateString,
"%Y-%m-%dT%H:%M:%S")[0:6]))

the '*' operator unpacks the tuple, producing the argument list for
datetime.datetime but it seems that the structure return by
time.strptime is not correctly flushed in memory.
msg77550 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-12-10 15:22
Can you reproduce this with a script that does nothing more
than

while True:
  myDate = datetime.datetime(*(time.strptime("2008-12-10T14:00:03",
"%Y-%m-%dT%H:%M:%S")[:6]))

I tried with both Python 2.4.5 on Solaris and Python built from
CVS (aka 2.7a0) on my Mac and see no memory growth of the
processes.  If there's a memory leak my guess is that it is
somewhere else.
msg77551 - (view) Author: Quentin Gallet-Gilles (quentin.gallet-gilles) Date: 2008-12-10 15:31
Tried it with Python 2.5.2 on WinXP, I see no memory growth either.
msg77577 - (view) Author: Gabriel Genellina (ggenellina) Date: 2008-12-10 23:19
After running for more than 2 hours, I could not see any memory growth 
with 2.5.2 on WinXP.
msg77614 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-12-11 14:46
A number of people on a number of platforms and versions can't reproduce
this.
History
Date User Action Args
2022-04-11 14:56:42adminsetgithub: 48870
2008-12-11 14:46:07skip.montanarosetstatus: open -> closed
resolution: works for me
messages: + msg77614
stage: resolved
2008-12-10 23:19:49ggenellinasetnosy: + ggenellina
messages: + msg77577
2008-12-10 15:31:30quentin.gallet-gillessetnosy: + quentin.gallet-gilles
messages: + msg77551
2008-12-10 15:22:02skip.montanarosetnosy: + skip.montanaro
messages: + msg77550
2008-12-10 14:40:40sebeguecreate