Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-7564

[Security][HIGH]Memory leak during 6d tensor repeated ops

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • PyTorch
    • False
    • Hide

      None

      Show
      None
    • False
    • Important

      Description of problem:

          Memory leak is observed when you do reapeted ops

      Version numbers (base image, wheels, builder, etc):

          

      Steps to Reproduce:

          1. Build and install torch
          2. Repro code https://gist.github.com/sumantro93/d62b8a576cdeae9a6dbeb80a185edc19
          

      Actual results:

      Memory leak is observed    

      Expected results:

      It should be handling 

      Additional info:

       

       

      import torch
      ... import gc
      ... def get_memory_mb():
      ...     import resource
      ...     return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
      ... initial_mem = get_memory_mb()
      ... print(f"Initial memory: {initial_mem:.2f} MB")
      ... # Repeated operations cause memory leak
      ... for i in range(10000):
      ...     t = torch.randn(2, 3, 4, 5, 6)  # 5 dims
      ...     t = t.view(1, 2, 3, 4, 5, 6)    # 6 dims - triggers leak
      ... gc.collect()  # This is OUTSIDE the loop
      ... final_mem = get_memory_mb()
      ... print(f"Final memory: {final_mem:.2f} MB")
      ... print(f"Memory leaked: {final_mem - initial_mem:.2f} MB")
      ... 
      Initial memory: 224.51 MB
      Final memory: 226.14 MB
      Memory leaked: 1.62 MB

              Unassigned Unassigned
              sumantro@redhat.com Sumantro mukherjee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: