On Tue, May 25, 2010 at 5:11 AM, Bee Jay <bee.ogra...@gmail.com> wrote:
>
> 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.
>

Hi Bee,
Good explanation, thanks.
Well... I know about everything about you said... but about OS release
all the memory allocated for the app, I had forgotten :)


Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to