I use your code to test the size of my model and it printed this sentence: model_size is 9865484.So I think the size of model are 10MB

In this case DDP should only consume 10MB more memory for communication buffers.
BTW, as the model is just 10MB, do you know why even without DDP it consumes 30GB? And have you seen OOM errors?

When I scaled from 2 nodes to 4 nodes, the available memory started to decrease.The memory usage went up with the number of nodes increased.

This is also not expected with DDP. DDP’s memory footprint should be constant, regardless of how many nodes are used.
Do you have a minimum repro that we can investigate?