| |

VerySource

 Forgot password?
 Register
Search
Author: hitone

Each time the Web Service system handle is called, it is increased by 1 and is not recycled when running. Please help me

[Copy link]

2

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-8-5 19:15:01
| Show all posts
Can you show me your client program? Do I need to add any configuration phases to the application? Thanks a lot
Reply

Use magic Report

0

Threads

22

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-8-5 20:30:01
| Show all posts
// Call the code of webservice...
if (tbChar.Text == "1") // decide whether to call gc
{
    client.Dispose();
    System.GC.Collect();
}
No configuration
Reply

Use magic Report

2

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-8-5 21:00:01
| Show all posts
Is your program single-threaded or multi-threaded? I call it from multiple threads. Is it related to multi-thread calls?
client.Dispose();
    System.GC.Collect(); I have added it in the program and it is useless
Reply

Use magic Report

0

Threads

22

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-8-5 21:15:01
| Show all posts
I am a client, no multithreading
But you say "a single thread will also cause the handle to grow, and there is no file stream access", so you have this question
Reply

Use magic Report

2

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-8-5 22:15:02
| Show all posts
I wrote a single-threaded test and found that it really dropped after 300 or so. It may still be related to multi-threading. I don't know why this phenomenon occurs when calling in multi-threading?
while (i<1000)
{
Service1 client=new Service1();
client.HelloWorld();
client.Dispose();
Thread.Sleep(1000);
Console.WriteLine("Execute {0} times", i.ToString());
i++;
To
}
Reply

Use magic Report

2

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-8-5 23:30:01
| Show all posts
Are there prawns?
Reply

Use magic Report

2

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-8-6 19:00:01
| Show all posts
The problem has not been solved yet.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list