linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aman" <aman@mistralsoftware.com>
To: "linuxppc embedded" <linuxppc-embedded@lists.linuxppc.org>
Subject: Memory Leak
Date: Thu, 13 Mar 2003 01:20:25 +0530	[thread overview]
Message-ID: <001701c2e8d0$a017ef80$370da8c0@aman> (raw)

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

 Hi All
 I am using consistent_alloc () to allocate consistent memory for DMA.  When
I free the buffers using consistent_free(), the /proc/meminfo shows a
memory leak of the buffer size allocated.

 I have attached a  module code to allocate memory when inserted and free
 when removed. The memory leak can be found using the command cat
/proc/meminfo.

 Also the consistent_alloc call gives an error something like "Kernel bug at
cachemap.." if we try to allocate more than 2MB.

Can anyone help me in solving these issues

Thanking you in advance
Regards
Aman




[-- Attachment #2: alloc_test.c --]
[-- Type: application/octet-stream, Size: 983 bytes --]

#define __NO_VERSION__
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/ioctl.h>
#include <linux/proc_fs.h>
#include <linux/wrapper.h>
#include <asm/io.h>


typedef int sint32_t;

char kernel_version[]= UTS_RELEASE;

uint8_t        *pu8_buffer;

int init_module (void)
{
    dma_addr_t      str_phys_addr;

    printk ("Init module\n");

    pu8_buffer = consistent_alloc (GFP_KERNEL, 0x200000, &str_phys_addr);

    if (pu8_buffer == NULL)
    {
        printk ("Could not allocate memory\n");

        return 0;
    }

    printk ("Physical address = 0x%x\n", str_phys_addr);
    printk ("Virtual address = 0x%x\n", (uint32_t) pu8_buffer);

    return 0;
}

void cleanup_module (void)
{
    printk ("Freeing )x%x\n", (uint32_t) pu8_buffer);

    consistent_free (pu8_buffer);

    return;
}

             reply	other threads:[~2003-03-12 19:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-12 19:50 Aman [this message]
2003-03-12 20:29 ` Memory Leak Matt Porter
  -- strict thread matches above, loose matches on Subject: below --
2002-06-20 15:06 Memory leak diekema_jon
2002-06-20  7:52 Skip Gaede
2002-06-22  2:22 ` Skip Gaede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001701c2e8d0$a017ef80$370da8c0@aman' \
    --to=aman@mistralsoftware.com \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).