[fpc-pascal] Powtils Apache and Windows Seven 64bits
bee.ography at gmail.com
Tue May 25 10:11:38 CEST 2010
On 25 Mei 2010, at 01:43, Marcos Douglas wrote:
> On Mon, May 24, 2010 at 3:30 PM, Leonardo M. Ramé <martinrame at yahoo.com> wrote:
>> Marcos, nobody is saying that you don't have to destroy instances when programming CGI apps.
> Okay, but if there is not memory leaks...
> I ever free my objects! But I did not know about no memory leaks in
> CGI programs...
Ok, Marcos... let's take a look at the logic of memory allocation. Everytime an app need memory, it requests it to the OS. So, OS always knows which part of memory belongs to what app. Once the app is terminated, OS will release all the memory allocated for the app so it can be used by other apps. This means memory leak only happens during the life of an app. The problem is... if your app is always running and keep requesting memory that will never be released later, the OS will unable to serve memory allocation request from other apps. At the end, the OS will be running out of memory, then the whole system will crash. That's why memory leak is a serious issue for long time running app such as FCGI app, service, daemon, etc. For an app with short life time, this isn't a serious issue. Nevertheless, it's a good and recommended practice to make sure your app has no memory leaks.
However, there's a chance when memory leak still persist though an app had already been terminated. It happens when some apps request for shared memory allocation. Since the memory is being used together by some apps, the memory will not be released until ALL the apps that using it got terminated. If the shared memory also being used by the OS kernel, then it will never be released by the OS, unless you restart the whole system. It is a very serious issue.
More information about the fpc-pascal