jasonjack2015 / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

Python: memory leak in protobuf.reflection.ParseMessage() #661

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

  import google
  import google.protobuf
  import google.protobuf.descriptor_pb2

  descriptor = google.protobuf.descriptor_pb2.DescriptorProto.DESCRIPTOR

  while True:
    google.protobuf.reflection.ParseMessage(descriptor, '')

What is the expected output? What do you see instead?

  Expected: infinite loop with constant memory usage
  Observed: infinite loop with rapidly growing memory usage

What version of the product are you using? On what operating system?

  protobuf 2.5.0
  python 2.7.3
  Scientific Linux 6.5 (x86_64)

Please provide any additional information below.

  The code above is a minimal standalone example (I don't really want to construct an endless series of DescriptorProto objects).  In reality I'm calling ParseMessage with a descriptor which was read from the input stream, but the outcome is the same: memory usage grows linearly with the number of messages parsed.

  I can't find anything in the documentation to suggest that ParseMessage requires the user to take special action to release resources.

Original issue reported on code.google.com by wbenf...@gmail.com on 13 Aug 2014 at 10:00