Re: [gtk-list] Re: glib memory management?



Erik Mouw wrote:
> On Tue, 20 Apr 1999 23:09:52 +0200, gtk-list@redhat.com (Drazen Kacar) wrote:
> > Erik Mouw wrote:
> >> I don't know about a way to manage a bunch of assigned memory, but I like
> > 
> > That would be memory gained with mmap() call. mmap("/dev/zero") or
> > a variation, since mmap() is not completely portable.
> 
> Here comes GLIB in: hide those portability issues for the programmer. ;-)

Come again? Have you ever looked at the glib sources and the files
left by `make install'?

1. glib-config is not portable
2. Programs depending on glib sometimes can't be compiled with the strict
   ANSI C compiler
3. glib messes with va_copy, which is compiler dependant and could have
   nasty effects
4. GNU/int types & co. have nothing to do with standards and (in case
   I decide to use them) set my system two years back
5. glib is built to be efficient with gcc extensions and doesn't
   perform as good as it could if I decide to use some other compiler
   
I'd really like my mmap()s to be left alone. I know how and when to
use #ifdef.

:-)

> I meant releasing the lock when the process that set the lock crashed, but
> if can be unlocked automagically when the process crashes, the problem is
> solved.

You can have that with SYSV IPC, just use semadj value. SYSV IPC won't
destroy semaphore set unless some process does that explicitely. POSIX
semaphores can do that, too. Cleanup is performed by _exit(2) call, so
I suppose even SIGKILL won't make problems.

> Other problem: the heap will almost certain be corrupted. We need
> a a journaled memory manager for this, just like a journaled file system.

I'm not sure about that. If one of the programs crashes, I wouldn't
expect the whole system to function as if nothing happened.
Look at the normal malloc packages. If a program writes data over
private malloc structures, malloc package won't work any more. Since
programs shouldn't crash, I don't see a point in doing this. Ensuring
that one crash won't deadlock the others is quite enough.

-- 
 .-.   .-.    Life is a sexually transmitted disease.
(_  \ /  _)
     |        dave@srce.hr
     |        dave@fly.cc.fer.hr



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]