Please do not reply to this email: if you want to comment on the bug, go to the URL shown below and enter yourcomments there. https://bugs.freedesktop.org/show_bug.cgi?id=3217
------- Additional Comments From [EMAIL PROTECTED] 2005-05-21 10:56 ------- Created an attachment (id=2734) --> (https://bugs.freedesktop.org/attachment.cgi?id=2734&action=view) patch to fix memory leaks in the PCI consistent memory handling code Apparently the patch mentioned in comment #10, in addition to breaking the i915 driver on Linux, also introduced a memory leak into the PCI consistent memory handling code for Linux. There are two problems: 1. drm_pci_alloc() allocates new drm_dma_handle_t structure, but drm_pci_free() does not free it - this leads to a memory leak in drivers which use drm_pci_alloc() and drm_pci_free(). (The BSD implementation of drm_pci_free() _does_ free the drm_dma_handle_t structure passed to it.) 2. drm_addmap() calls drm_pci_alloc(), but does not save the pointer to the created drm_dma_handle_t structure - instead, it takes the virtual and bus addresses from it and stores just them; the drm_dma_handle_t structure is leaked. The attached patch attempts to fix these problems. The solution to the first problem is obvious: drm_pci_free() must free the structure passed to it, so that the Linux and BSD implementation behave in the same way. The second problem, however, is worse - the code has calls like drm_pci_free(dev, &dmah); which would obviously break if drm_pci_free() will free its argument. The real problem is that the Linux DRM core does not have an OS-specific drm_local_map_t - therefore there is no place to store the drm_dma_handle_t pointer from drm_pci_alloc() to pass it to drm_pci_free() later. Introducing real drm_local_map_t to the Linux DRM core will need major changes, therefore my patch uses a somewhat hackish approach: 1) drm_addmap() just calls kfree(dmah) on the drm_dma_handle_t pointer from drm_pci_alloc() to avoid leaking that memory. 2) A new function - __drm_pci_free() - is introduced; this function works just like drm_pci_free(), but does not free the drm_dma_handle_t structure passed to it. This function is used instead of drm_pci_free() in places where the drm_dma_handle_t structure is constructed on the stack. Only the DRM core has such code, therefore __drm_pci_free() does not need to be exported. This patch is only compile tested now, like the previous one. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel