Status: New
Labels: Type-Defect Priority-Medium

New issue 661 by Python: memory leak in protobuf.reflection.ParseMessage()

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.

You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:

You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to