• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Instruments, how to fix leak in C Lib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instruments, how to fix leak in C Lib


  • Subject: Re: Instruments, how to fix leak in C Lib
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Wed, 02 May 2012 10:43:15 +0200

Le 2 mai 2012 à 09:59, Alexander Reichstadt a écrit :

> Hi,
>
> through Instruments I found a memory leak outside my code in a pqlib, the postgres client library.
>
> This is what Leaks prints out:
>
> Bytes Used	# Leaks		Symbol Name
>  84.81 KB     100.0%	48	 	PQgetResult
>  84.81 KB     100.0%	48	 	 pqParseInput3
>  80.00 KB      94.3%	40	 	  pqResultAlloc
>  80.00 KB      94.3%	40	 	   malloc
>   4.00 KB       4.7%	4	 	  pqAddTuple
>   4.00 KB       4.7%	4	 	   malloc
>    832 Bytes    0.9%	4	 	  PQmakeEmptyPGresult
>    832 Bytes    0.9%	4	 	   malloc
>
>
> I thought that inside PQgetResult there ought to be a call to pqParseInput3, inside of which I would then e.g. find a call to pqResultAlloc. But this is not the case. So I thought maybe the compiled version of the C-library I am using here does not match the sourcecode I obtained. I recompiled the library from source, built the Objective-C framework and rebuilt my app and did a new trace, but the leaks' trees were identical also now that I excluded the source for error of there being a difference in version.
>
> Please can someone help how to read this?
>

Are you properly using this library ?
If you alloc some PQ structure and does not free them, the leaks will appears in the libpq, but your code will be the culprit.
Make sure you properly call PQclear on all result you got from a libpq call, and PQfinish on all connections objects.

-- Jean-Daniel





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Instruments, how to fix leak in C Lib (From: Alexander Reichstadt <email@hidden>)

  • Prev by Date: Instruments, how to fix leak in C Lib
  • Next by Date: Re: Minimal document-based app
  • Previous by thread: Instruments, how to fix leak in C Lib
  • Next by thread: Re: Instruments, how to fix leak in C Lib
  • Index(es):
    • Date
    • Thread