[Ur] Some more questions:

Marc Weber marco-oweber at gmx.de
Sun Nov 7 11:27:40 EST 2010


> CGI doesn't support channels, while FastCGI involves multiple threads in 
> a single process.  Pending channel sends are only stored in-memory and 
> would certainly be lost in a sudden crash.
So its important to tell webservers to only start one instance.

> #{..}
:-( my fault. I should have recognized it.

Back to system().

I made the example from the wiki compile.
I don't understand the scope of regions yet.

quote (manual):

  void *uw_malloc(uw_context, size_t);
  [...] Thus, there is no uw free(), but you need to be careful not to keep ad-hoc C pointers to
  this area of memory.

  For performance and correctness reasons, it is usually preferable to use uw malloc() instead of malloc().
  The former manipulates a local heap that can be kept allocated across page requests, while the latter
  uses global data structures that may face contention during concurrent execution.

1)
looking at urweb.h there is a uw_free(). So ist he documentation out of
date here? Or is it an internal function?

2) "can be kept allocated across page requests"
Can I tell urweb to keep or throw away the memory after a request
completes?
When is such a region guaranteed to end so that the memory will be
freed? When serving files that way you don't want urweb to eat up all
your memory. Why not use apache? Using urweb it is easier to restrict
access. I don't have a use case - I'd like to be aware of the
limitations.

Let's assume I used system("cat 200mb.file") and send this to the user
using blob (less than optimal because its not streamed .. But I don't
care for now) .. When would the buffer I allocated to keep the stdout
data be freed again?

Because there is no uw_realloc (?) is the way to go using realloc,
malloc copying the data into a uw_malloc'ed buffer before returning?

Marc Weber



More information about the Ur mailing list