Hi there FreeBSD guys,

I am having some memory allocation woes in my FreeBSD kernel
device driver. I allocate DMAable memory with something like:

    retval = bus_dma_tag_create
    (
        NULL,
        4,
        0,
        BUS_SPACE_MAXADDR,
        BUS_SPACE_MAXADDR,
        NULL,
        NULL,
        (1 << 20),
        1,
        (1 << 20),
        0,
        &memtag
    );

    retval = bus_dmamem_alloc
    (   
        memtag,
        (void **) &vaddr,
        BUS_DMA_WAITOK,
        &memmap
    );

    retval = bus_dmamap_load
    (   
        memtag,
        memmap,
        vaddr,
        (1 << 20),
        my_callback,
        NULL,
        0
    );

which seems to succeed/work. But when I attempt to release the
allocated memory like this:

    bus_dmamap_unload(memtag, memmap);

    bus_dmamem_free(memtag, (void *) vaddr, memmap);

    bus_dmamap_destroy(memtag, memmap);

    bus_dma_tag_destroy(memtag);

The actual memory does not seem to get released. If I continually
load and unload the driver, the physical addresses allocated
keep increasing by the amount I am trying to allocate and never
seem to get re-used. In addition, after enough load/unloads
'bus_dmamem_alloc' returns ENOMEM!

So to mem it does not look like the deallocation incantation
is actually releasing the allocated memory back to the system.

Any ideas would be appreciated.

Further information:

Machine:
    P4 1.4 GHz
    512MB memory

OS:
    FreeBSD 4.5

Thank you.

Greg.

-- 
+------------------------------------------------------+
| Do you want to know more? www.geocities.com/worfsom/ |
|              ..ooOO Greg Johnson OOoo..              |
| HW/SW Engineer        [EMAIL PROTECTED] |
| Canon Information Systems Research Australia (CISRA) |
| 1 Thomas Holt Dr., North Ryde, NSW, 2113,  Australia |
|      "I FLEXed my BISON and it went YACC!" - me.     |
+------------------------------------------------------+


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to