I have a general question regarding memory errors. I frequently ran into memory errors such as seg fault, double free, etc. Sometimes I got the following traces for example.
Created application is working too slow, looks like there are a lot of memory leaks, there are a lot of pointers. Any effective tool for run-time errors and memory leaks detection in Visual Studio C++?
I am running Valgrind on my program. It shows me two errors but mentions only addresses against them and not actual code even on a debug build.
The output is
==23002== Memcheck, a memory error detector. ==23002== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. ==23002== Using LibVEX rev 1575, a library for dynamic binary translation.
I am new to C and linux. My code below does arbitary writes but I cant figure out where or how it does it.
I am calling the insertNode() function with seq = 'MISSISSPPI$' and alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$'
Code:
Weird behaviour I should mention is that when I check for NULL pointer in node->child[index], the unassigned values are not null anymore, they point to arbitary memory.
Is that possible that SHM shared memory is counted as cache memory on Linux with kernel 2.6.18?If find it really odd since this memory is not file backed, but I have a piece of code that loads data using shm_open+mmap, and it generates an amount of cache memory in /proc/meminfo that corresponds exactly to the amount of shared memory (I load that data from a file but I am using posix_fadvise(fd,0,0,POSIX_FADV_DONTNEED) to ensure this file is not cached and I made sure that it is working as expected). As far as I know SHM memory was not tagged as cache memory with kernel 2.6.9.If it is the case it is really unfortunate since normally cache memory can be considered to be part of the "available" memory since it can be flushed promptly but this is clearly not the case with SHM memory... Is there an easy way to get the total amount of used SHM memory on a system?
I'm aware of Linux ECC project, but how to detect ECC errors/warnings under Linux? Do I need to load additional modules in order to get this information?
I have Mythbuntu 10.04 installed on an exclusive HTPC and working great... until tonight. After letting the system update some packages (161 packages if I remember right), I suddenly have an issue where the graphical system won't start. After researching I found three error messages that might be causing that.
1. At the start of splash screen I see "UUID=xxxxxxxCD7 not ready yet or not present" I checked in /etc/fstab and found that this is the swap partition. I don't remember seeing this before so this could be the culprit.
2. I'm not at the computer in question right now but I saw a Plymouth error about "mountall" and then the message "plymouth command failed". Not sure if this could be the main error.
3. after a while (usually ca. 1-2 min) I receive thousands of errors of the kind "out of memory"... "kill process XXXX" (process vary wildly e.g. dbus-daemon, mysql, etc)... "process killed"..."respawning"
After error 3, I'm not able to switch to graphical console (ctrl-alt-F7). If I was in the graphical console at this moment, I simply can't switch to the CLI console. I'm always afraid of updating my system since I've seen lots of things breaking afterwards (usually the proprietary graphic drivers) but this is really strange.
I am trying to compile a program for my assignment at school that uses curses.I have installed libncurses5-dev, and curses.h is now in /usr/include, but I am getting all these errors(it compiles fine at school).
Code: grcunning@grcunning-desktop:~/school/cs474/assign7$ gcc -o proj7 proj7.c /tmp/cc2ZFXrs.o: In function `main':
I'm currently developping a program in C++, using Qt, for an embedded board (SBC9261).It works well but crashes after some time, due to a system memory overload (my program uses more and more memory until 100%, when it crashes).I've been able to figure out the source of the memory leak :The function f is called by my program every second. f instanciates a new object (a QImage from the Qt lib), does a bunch of processing on it, and returns it to the calling function :
Code: QImage *MyClass::f(QString filename) {// Open image QImage *image = new QImage(filename);
I have 2 applications that send and receive messages through shared memory IPC. When I run the app ..it works but the number of messages per sec keeps changing drastically sometimes it is 400-500 per sec..then 800 then 1200 then 2000. is this normal with SHM IPC or could it be a code related issue.
I have faced a problem with my code (a small tcp server). After the thread returns, the memory not decreases, but when a new connection is made, memory not increases and the new connection initialize a new thread with a same thread id of the previous thread. When two connections are made at same time, two thread ids are created and when the respective threads returns the memory not decreases. The Valgrind indicates that not memory leak occurs, the pointers are released. Indeed, more memory are allocate when new thread id is created. i used gcc and debian.
I have been assigned a school project on detecting memory leaks in linux processes. I am reading.. but have found it hard and inefficient to go through the very vast documentation not knowing what to really look for. Could you please give me some guidelines on this subject?
In words, AND the byte at memory location 45 with immediate value 03. As reports "Ambiguous operand size for and". How could I code the instruction such that as understands my intention?
john: .byte 45 and byte[john],03 gives the same error.
I need to write a small program that eats away at availabe memory. I need to creaty a memory leak to test how other programs cope. I need to run this program on linux and see if the available memory is decreasing.
So I have done: Code: int main() { int *buffer; while(1)
I have a single board computer previously running DOS. I recently made Linux running on it. Now that the system is running Linux, I have to translate the code that was supported by DOS. The code has segments that allow direct access of memory mapped registers through the macro _MK_FP and do read/write. I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?
How do we allocate memory of struct? what i did was
Code:
int main() struct amp {
[code].....
cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl; it gives me an error--- In funtion 'int main()': error: expected primary-expression before 'struct' error: expected ';' before 'struct'
I have have to write a video device driver, but rendering will happening in memory, not on a physical card. I already wrote a simple driver stripping out hardware piece code from an existent vodoo driver. I an install it, uninstall it but i dont know how to map it to a file /dev/mydevice_video
Is there a field in fb_info or fb_vscreenifo where the device name has to be passed before calling register_framebuffer.
I have a kernel module that I am trying to do a phys_to_virt() and then perform a memcpy to the returned virtual address. The problem that I'm having is that my module crashes during the memcpy when trying to do this on a physical address in high memory. Do I need to need to perform some kind a mapping operation on high memory address for this to work?
i'm sniffing network packets with pcap in ubuntu, i need to save these packets somewhere in the memory and after a while read ans send them. how can i do this?
I can't figure out why I'm getting seg fault in this program im making in c++. The program is of the game "Mastermind" board game which I'm sure many of you might have heard of.im fairly new to coding c++. I do not know why I'm getting seg fault error when trying to compile as I'm not using any pointers? or trying to access memory that was not allocated to me?
I've generated some srt subtitle files using gocr from pgm files used in DVD's. The ocr program gets confused between lower case L and upper case i and sees them as the same thing. This results in words with capital i's in them instead of lower case L.
What is the best way to automate the correction without a spell checker? I tried sed, but it's difficult to tell between the i's that you want and those that need changing. I figured that any word that consists solely of capital i's is ok, e.g. Roman Numerals, but any capital i not at the beginning of a word needs changing.
I am running a java application on centos. For now I have a gsm modem connected via the the usb cable. Below is the message I get when I type the command dmesg | grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A 00:0c: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A usb 2-2: pl2303 converter now attached to ttyUSB0
Here is my program. It asks the user for input and then prints a shape of a certain length. The errors I get when I compile are:
shape.c: In function "main": shape.c:22: error: expected identifier or "(" before "int" shape.c:58: error: expected expression before "return" shape.c:59: error: expected expression before "}" token shape.c:59: error: expected expression before "}" token #include<stdio.h> .....