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



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. ;-)

>> - Locking in the memory manager: the idea of a shared memory segment is
>>   that it is shared between processes (sic). If one of them allocates a
>>   piece of memory in the segment, others shouldn't be able to do the same,
>>   so you need some kind of locking, like SYSV IPC semaphore sets.
> 
> I had a master-slave project in mind, so there would be only one
> process which allocates memory. Others would have read-only access.

OK, in that case it will work.

>> - If the heap in the shared memory segment is corrupted and the memory
>>   manager crashes, the lock is not released and all other processes hang,
>>   so you must have some way to timeout and solve the problems.
> 
> Depends on your system. If you happen to have sem_open() and friends,
> it can be done automagically when the last process exits. If you don't
> have POSIX.1b, tough luck.

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. Other problem: the heap will almost certain be corrupted. We need
a a journaled memory manager for this, just like a journaled file system.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




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