There is no memory leaks in this code.
The "scan the heap for memory leaks" doesn't matter until the main() returns.
Printable View
There is either a memory leak in this code, or the Glowcode profiler is wrong. I dont understand how you can sit there and say there is no memory leak unless you run a profiler on it yourself.
Have you done that?
Many other people on google have had similiar problems with the winsock socket() call. Do a search.
Regards
Precisely. In my opinion, if you feel that you have found a memory leak in the implementation of socket(), then take the issue to the maintainer. Maybe it turns out that there really is such a bug, or maybe there is a bug in the memory leak detector.Quote:
Originally Posted by GCDEF
Well, if some piece of code leaks memory it's a bug and you should contact the provider.
In this case it may be that the first call to socket allocates some global data which is then reused in further calls. You could repeatedly open/close the socket to check that possibility. Do it a 10.000 times or so while inspecting the memory allocation behaviour.
Many compilers provide source code to their runtime functions. Why not confirm it by debugging the source code to see if there really is a leak?
Anytime a programmer suspects a runtime function is faulty, and the programmer has the source code, do not say "bug" or "memory leak" without confirmation. You need to verify your claims by getting your hands dirty and seeing what's going on under the hood. Then you have solid information to give the provider (line of the source code, what goes on, etc.). GlowCode is not confirmation, as many of these third-party leak detectors have false positive reports.
If you can't verify it yourself, then you report it to the provider and say you suspect there is a problem, and not out and out say there is a memory leak or bug, as you have no real confirmation of that.
Regards,
Paul McKenzie
Thanks all!! Working on this now!