LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2010, 01:17 AM   #1
snaily
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
How can I check the memory consume of kernel modules,some tools like top?


I've added a tcp_hook module(just like the pf)to freebsd kernel,but something goes wrong with it.The kernel always crashed one or two hours later.Backtrace the core dumped file and some messages as follow:


#0 doadump () at pcpu.h:165
#1 0xc06b2ec2 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:410
#2 0xc06b3158 in panic (
fmt=0xc09bf143 "kmem_malloc: entry not found or misaligned")
at /usr/src/sys/kern/kern_shutdown.c:566
#3 0xc0836cd6 in kmem_malloc (map=0xc144b0c0, size=0, flags=1)
at /usr/src/sys/vm/vm_kern.c:382
#4 0xc082e24e in page_alloc (zone=0x0, bytes=0, pflag=0x0, wait=1)
at /usr/src/sys/vm/uma_core.c:957
#5 0xc083064b in uma_large_malloc (size=0, wait=1)
at /usr/src/sys/vm/uma_core.c:2723
#6 0xc06a79ad in malloc (size=0, mtp=0xc0a1f6e0, flags=1)
at /usr/src/sys/kern/kern_malloc.c:329
#7 0xc3c22f0c in Hunt() from ./tcp_input_hook.ko
#8 0xc3c23565 in TcpHook() from ./tcp_input_hook.ko
#9 0xc3c23682 in tcp_input_hook () from ./tcp_input_hook.ko
#10 0xc07531ca in ip_input (m=0xc32aa300)
at /usr/src/sys/netinet/ip_input.c:791
#11 0xc072c0a3 in netisr_processqueue (ni=0xc0a93c98)
at /usr/src/sys/net/netisr.c:236

It seems that no more free memory to malloc, how can I track the memory allocation?Then to identify whether this is a memory leak caused by my code or some other reasons.

Btw,I have modified my code into snort and it runs smoothly for quite a long time,the memory usage keeps a stable value.So it doesn't seems to have memory leak.

3ks for any suggestions!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to dynamically allocate memory in a kernel modules? Triumphant Programming 1 12-08-2009 10:19 PM
how to see kernel memory in top ? notepod Linux - Software 5 09-28-2009 11:42 AM
Azureus to much memory consume vladoportos Debian 1 02-28-2006 06:20 PM
Applications consume huge memory amount in kernel-2.6.4 l2g Red Hat 3 04-09-2004 09:49 AM
compiling a kernel: module-init-tools conflict, depmod problem, modules sterrenkijker Debian 3 03-08-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration