Date: Tue, 16 Oct 2001 14:42:17 +0900 From: "Eugene M. Kim" <ab@astralblue.net> To: freebsd-hackers@freebsd.org Subject: contigmalloc + contigfree = memory leak? Message-ID: <20011016144217.A35188@the-7.net>
next in thread | raw e-mail | index | archive | help
Greetings, QUESTION: Does contigfree() really free up memory allocated using contigmalloc()? BACKGROUND: I've been trying to make up a kmod that allocates/deallocates memory in a specific physical address range. Mike Smith suggested using busdma functions to do the job, so I followed it. After allocating and deallocating memory several times, it seemed that bus_dmamem_free() was not freeing the memory properly. I looked at busdma_machdep.c where bus_dmamem_free() was defined, and found: void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { /* * dmamem does not need to be bounced, so the map should be * NULL */ if (map != NULL) panic("bus_dmamem_free: Invalid map freed\n"); /* XXX There is no "contigfree" and "free" doesn't work */ if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) free(vaddr, M_DEVBUF); } However, there *is* contigfree() and a related patch was applied on -current around August, so I did the same thing (adding an else clause to call contigfree(vaddr, dmat->maxsize, M_DEVBUF)). It didn't solve the memory leak problem either, so I'm stuck here... Could anyone shed a light on this? Regards, Eugene To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011016144217.A35188>