code: def _test_memory_sharing_disabled(fabric, tensor, model):
      is_spawn = fabric.strategy.launcher._start_method == "spawn"
      assert not is_spawn or tensor.is_shared()
      assert not model.layer.weight.is_shared()
      assert not model.tied_layer.weight.is_shared()
      assert not model.buffer.is_shared()
  
      # weights remain tied
      assert (
          model.layer.weight.data_ptr()
          == model.tied_layer.weight.data_ptr()
      )
      assert torch.equal(
          model.layer.weight.data, model.tied_layer.weight.data
      )
      fabric.barrier()
  
file_path: pytorch-lightning/tests/tests_fabric/strategies/launchers/test_multiprocessing_integration.py
imports: import pytest
  import torch
  import torch.nn
  from lightning.fabric import Fabric
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: _test_memory_sharing_disabled(fabric, tensor, model) without return types