🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4603

Re: Server Socket Problem

#4603
From: Patrick Wong
Date: Mon, 17 Jan 2005 11:41
41 lines
2416 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:41eb7b62$1@newsgroups.borland.com...
>
> Always use the 'delete' operator instead, it does free the memory:
>
>     delete FClientSocket;
>
Okay, but this does not help in the problem I encounter.  Finally I
addressed where the problem is.  It's in the function below:

int  __fastcall TLogManger::GetFileSize(AnsiString strFileName)
{
  TSearchRec *pSearchRec;
  int         FileSize = 0;

  try
  {
    pSearchRec = new TSearchRec();

    if(FindFirst(strFileName, faAnyFile, *pSearchRec) == 0)
      FileSize = pSearchRec->Size / 1000;

    FindClose(pSearchRec);
  }
  __finally
  {
    delete pSearchRec;
    pSearchRec = NULL;
  }

  return FileSize;
}

Each client thread created will call a function WriteAppLog(), in which the
log file size will be checked, by calling the function above.  The function
increases handles to the application continually (I monitor using Task
Manager).  When clients are created and terminated in a rapid rate, so does
the number of handles.  But the number of handles will never decrease.
Finally the paged memory pool get exhausted.  Run the application without
calling the function does not have problem.  Got the code from an
introductory page of Delphi on the web.
Technical Details
Message-ID: <41eba45a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41e50bd0@newsgroups.borland.com> <41e5d556@newsgroups.borland.com> <41e63652$1@newsgroups.borland.com> <41eb3f34$1@newsgroups.borland.com> <41eb7b62$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9670bce8fe2a64d1
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Patrick Wong" <patrickwong@computer.org>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41e50bd0@newsgroups.borland.com> <41e5d556@newsgroups.borland.com> <41e63652$1@newsgroups.borland.com> <41eb3f34$1@newsgroups.borland.com> <41eb7b62$1@newsgroups.borland.com>
Subject: Re: Server Socket Problem
Date: Mon, 17 Jan 2005 19:41:13 +0800
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 203.82.252.252
Message-ID: <41eba45a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105962074 203.82.252.252 (17 Jan 2005 03:41:14 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail