On Tue, 4 Apr 2000, Stephane Bouchard wrote:

> I send you a small application (insmod mbuff before running). This
> application use one area of memory but with lsmod, I see 3 in the used column.

I would understand 2.  + 1 memory is allocated.  + 1 memory is mapped.
I will check why is it 3. But I would not worry about it is as long as after
exiting from your program it goes back to 0. WARNING: killing your program as
it is now, will decrease usage count only by 1, because mbuff_free will not
be called. Use mbuff_attach/detach to avoid this problem.

BTW. There is a bug in your example:

ptr=(volatile int*)mbuff_alloc("shared_data",5);
    if(ptr==NULL) exit(2);
    ptr[0]=0;
    ptr[1]=1;
    ptr[2]=2;
    ptr[3]=3;
    ptr[4]=4;

You should do: mbuff_alloc("shared_data",5*sizeof(*ptr));
Fortunately mbuff always rounds the size up to the multiplicity of page size
(4096 B).

Did you compile mbuff with -DSHM_DEMO ? This option is for testing purposes
only. Did you insert some other kernel module doing mbuff_alloc ? This would
explain usage count of 3.

You can use mbuff_alloc/mbuff_dealloc programs to manually manipulate
allocation count.

Best regards,
--
Tomek

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to