[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] memory mangement - leak forbyggelse.



On Wed, Mar 20, 2002 at 02:26:32PM +0100, Anders Melchiorsen wrote:
> Det er da muligt, at der kommer et lille leak første gang de bruges;
> det har jeg ikke undersøgt. I givet fald vil det ikke akkumulere ved
> gentagen brug, og er således næppe noget problem.
Det er jo ikke et leak hvis en funktion allokerer et stykke humkommelse
første gang den bliver kaldt, og den derefter aldrig deallokerer det
igen. Det er kun et leak hvis den gør det hver gang.

> Et problem er det dog at bruge globale variable (som disse pointere
> reelt er) i flertrådede programmer. Du skal derfor nok finde nye
> versioner, hvor der ikke bruges globale variable. De hedder vist nok
> gethostbyname_r() og strerror_r() men jeg kan faktisk ikke finde "man"
> sider om dem på mit eget system lige nu :-(.
man 3 gethostbyname
man 3 getipnodebyname (som allokerer hukommelse dynamisk)

Der er som udgangspunkt ikke et problem med strerror og tråede
programmer, da den returnerer en pointer til et statisk array af
strenge i næsten alle tilfælde. Kun hvis errnum ikke er en gyldig
fejlbesked, overskriver den informationerne i en streng.

Derudover kan jeg heller ikke finde strerror_r på min linux box, men på
FreeBSD er den listet på man strerror.

-- 
/-----------------------------------------------------\
| Klaus S. Madsen      | "Failure is not an option... |
| ICQ: 45400164        |  It comes bundled with your  |
| www.hjernemadsen.org |  Microsoft products!"        |
\-----------------------------------------------------/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *