dubbo-go icon indicating copy to clipboard operation
dubbo-go copied to clipboard

fix common.URL memory leak

Open LQyt2012 opened this issue 8 months ago • 11 comments

Add the urlPool to manage the memory allocation of common.URL

LQyt2012 avatar Apr 06 '25 12:04 LQyt2012

check ci error.

marsevilspirit avatar Apr 06 '25 12:04 marsevilspirit

We need all CI to pass to ensure code quality.

marsevilspirit avatar Apr 07 '25 08:04 marsevilspirit

There are two questions. The first is why memory leaks occur here. The other question is that pooling can improve memory utilization but it does not seem to fundamentally guarantee that there will be no memory leaks.

No-SilverBullet avatar Apr 07 '25 09:04 No-SilverBullet

There are two questions. The first is why memory leaks occur here. The other question is that pooling can improve memory utilization but it does not seem to fundamentally guarantee that there will be no memory leaks.

In the original issue, there is a profile screenshot that shows that this method holds the memory allocation.

LQyt2012 avatar Apr 25 '25 11:04 LQyt2012

This reset and release method needs to be called when dealing with the memory leak of type URL.

LQyt2012 avatar Apr 25 '25 12:04 LQyt2012

这 reset 函数怎么没有一个地方调用?

AlexStocks avatar May 11 '25 07:05 AlexStocks

这 reset 函数怎么没有一个地方调用?

The user should call the Reset method when retrieving a URL structure from the pool.

LQyt2012 avatar May 12 '25 11:05 LQyt2012

这 reset 函数怎么没有一个地方调用?

The user should call the Reset method when retrieving a URL structure from the pool.

maybe u can submit a PR to dubbo-go-samples to show how to use it.

AlexStocks avatar May 13 '25 01:05 AlexStocks

这 reset 函数怎么没有一个地方调用?

The user should call the Reset method when retrieving a URL structure from the pool.

You mean that users should handle this manually? This is not a good idea, we should resolve this issue within dubbo-go itself. This approach would only increase the learning curve for users.

marsevilspirit avatar May 13 '25 12:05 marsevilspirit

这 reset 函数怎么没有一个地方调用?

The user should call the Reset method when retrieving a URL structure from the pool.

You mean that users should handle this manually? This is not a good idea, we should resolve this issue within dubbo-go itself. This approach would only increase the learning curve for users.

You can offer your solution, and then we can discuss it.

LQyt2012 avatar May 16 '25 13:05 LQyt2012