[fpc-pascal] methods of an object to create others objects

Marco van de Voort marcov at stack.nl
Wed Jul 7 21:11:47 CEST 2010


In our previous episode, Andrew Brunner said:
> > Well... I think CGI gateway is a good way. If the real app (FCGI) have
> > troubles, I can change the URL that the CGI (gateway) uses to call the
> > real app and to point to another app (in other server, e.g.). What do
> > you think about it?
> 
> I think it would be worth discussing what can be done or at least
> start thinking about getting the memory manager not to blow-out any
> more.  I really don't want to re-start server software just because a
> few apps (embedded in the service application) crash.

Well, first, there is the question if there is something to be fixed. (I
myself think that plugging a few holes here and there once a quarter is
might be worth avoiding the GC overhead and complexity.  To be honest I
never understood what all the fuzz about GC is about).

But anyway, the question has been asked before, and I then archived the
responses here:

http://wiki.freepascal.org/garbage_collection

For the specific case of web applications, there are other possibilities,
since in general, one could try to exploit the knowledge that anything
allocated during a request can be deallocated. Like the old mark/heap

Of course somehow we would have to manage two heapmgrs then (for sessions
and requests one each), and avoid polution the session heapmgr with request
blocks. (e.g. by modifying ansistring etc helpers to avoid copy-on-write
semantics)

One could even regularly stream the session(s) over IPC to another
addressspace (or flush to DB) once in a while and reset the session space
too.
 
> Has anyone with experience with developing the memory manager been
> following?

Not likely, since I haven't seen any insights in this thread.

>  What about a separate discussion on application
> stabilization after an unhanded exception? 

No system is safe for that. Even a managed .NET or Java app can NIL some
variable in some unlikely codepath, and every subsequent request can raise a
NIL exception, resulting in a effectively defunct app.

Moreover, GC only handles memory, not handles, DB connection etc.

A real solution is not availble.

> That would be a necessity for at least my platform which is compiled with
> FPC - and certainly FCLWeb generated back-end apps too.

It is not a problem of FPC, but of all applications in general.



More information about the fpc-pascal mailing list