URLAccess - does it leak memory?
URLAccess - does it leak memory?
- Subject: URLAccess - does it leak memory?
- From: Justin Greenfield <email@hidden>
- Date: Thu, 30 Jan 2003 20:12:47 -0600
Forgive me if I am off base here, but in trying to leak test some code
using MallocDebug, it looks like URLAccess leaks memory. I should say
that I am new to using MallocDebug, so maybe the problem is in the way
I am interpreting its results, but I can't come up with any other
explanation.
To verify that it wasn't just something funny in they way I was using
URLAccess Manager, I downloaded the URLAccessSample from:
http://developer.apple.com/samplecode/Sample_Code/Networking/
URLAccessSample.htm
I built that little app in PB and then launched it from within
MallocDebug. Using URLAccessSample, I chose the "URLDownload" function
to download
http://www.apple.com.
Once it finished and I got the "transfer was successful" message, I
switched back to MallocDebug and chose "Definite Leaks" from the popup
menu.
It shows that application event loop leaked 240 bytes. Drilling down
through the event dispatching and so on, so forth, I finally get down
to the part that says URLDownload leaked 224 bytes and URLNewReference
leaked 16 bytes. Here's a breakdown:
URLDownload: 224
OpaqueURLReference::download(FSSpec*, char**.....): 160
URLAccess::PURL::scheme() const: 80
CFURLCopyScheme: 80
URLAccess::PURL::fullPath() const: 32
URLAccess::PURL::path() const: 16
.... CFURLCopyScheme: 32
URLAccess::PURL::resourceSpec() const: 16
.... CFURLCopyScheme: 32
OpaqueURLReference::doTransfer(Security::_Network::Transfer*): 16
OpaqueURLReference::DetermineSourceFileInfo(): 16
URLAccess::PURL::scheme() const: 16
CFURLCopyScheme: 16
OpaqueURLReference::setIandA(): 16
URLAccess::PURL::scheme() const: 16
CFURLCopyScheme: 16
URLAccess::PURL::host(): 16
URLAccess::PURL::scheme() const: 16
CFURLCopyScheme: 16
URLAccess::PURL::fullPath() const: 64
URLAccess::PURL::path() const: 32
.... CFURLCopyScheme: 32
URLAccess::PURL::resourceSpec() const: 32
.... CFURLCopyScheme: 32
URLNewReference: 16
URLAccess::PURL::scheme() const: 16
CFURLCopyScheme: 16
So, it looks to me as though anything in URLAccess that calls through
to the private URLAccess::PURL::* functions is leaking 16 bytes every
time it is executed.
So are these leaks real? If so, doesn't URLAccess become a major
memory sieve if your app does a lot of work with URLReferences? Or is
MallocDebug just seeing something as a leak that it really shouldn't?
My system is running 10.2.3 and I'm using the Dec 2002 dev tools.
Thanks for any insight into this. I really want to use URLAccess and
avoid having to redo everything with CFHTTPMessage/Stream if possible.
Justin G.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.