Programming :: Didn't Change The Original Value Of The Pointer It Was Trying To Use For Allocation?
Feb 8, 2011
A friend working in HPC environments commented me that he had an issue regarding the use of the malloc() function.What issue?He told me that he has had cases in where malloc() instead of returning a NULL pointer on failure, simply didn't change the original value of the pointer it was trying to use for allocation, thus forcing him to initialize pointers to be allocated with malloc() to NULL, so that he could be sure that if malloc() fails, a test for NULL would make sense.
View 12 Replies
ADVERTISEMENT
Jun 27, 2009
I have been googling trying to fix this ... basicly I have a (int **) variable, and when I try to pass a (int) value to a specific position, I have seg.fault.Resuming what I have is:
int ** p;
p[0][0] = 1; //segmentation fault
View 7 Replies
View Related
Apr 30, 2011
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?
View 4 Replies
View Related
Jan 13, 2010
I'm maintaining a c++ application running on a 64-bit RHEL5 server w/32GB ram, but compiled to be a 32-bit executable with g++. The application handles large amounts of data, and has lately been throwing a st9bad_alloc exception. "top" shows the application as dieing right around when VIRT=~3GB, SWAP=~1.5GB and RES=~1.5GB. In the core dump I can see that it's consistently failing to push_back() a piece of data onto a std::vector (which already has hundreds of thousands of objects in it).
I know 4GB is the maximum address space for 32-bit applications. I've learned from this lwn article that a 32-bit kernel reserves 1GB of address space, leaving 3GB for user space. However I'm not running a 32-bit kernel, so that really doesn't answer anything.I wrote a dummy app which called malloc() over and over in a for loop, and it is able to allocate right up to the 4GB before it fails. I don't understand why this one seems to be able to allocate more.
The only difference between the two apps (besides malloc vs std::vector:ush_back), is that the 3GB crashing application attaches to 512mb of shared memory.Anyone have any ideas why this application would be crashing at 3GB? Is there any more diagnostics I should be doing? I would ultimately like to port this to 64-bit for a number of reasons, but it is a big undertaking for my organization, and I'd like to better understand what's going on here.
View 3 Replies
View Related
Mar 30, 2010
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'
View 9 Replies
View Related
Feb 8, 2011
I'm performing some explorations in terms of memory allocations in ANSI C, using the following compiler:
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
and I started to try to make the compiler complain for a huge data structure, so I coded this:
[code]....
I mean, I can always read the man entry for gcc but I rather ask because I can then have interaction...
View 11 Replies
View Related
Feb 23, 2011
I had issues with changing the pointer when compiz was active in ubuntu 10.10. it would not change when on the desktop, only when hovering over a window.I solved this issue by doing the following:
Hit alt f2 and enter-> gconf-editor
Then goto-> /->apps->compiz->general->allscreens->options
Then in "cursor_themes" type in the name of the pointer theme(Eg. DMZ-White)
This should resolve the issue with compiz.I am not going to go over that here.Oh yea don't forget to logout/login or press ALT F2 and enter compiz - -replace to refresh the pointer...
View 1 Replies
View Related
Jun 3, 2010
I want to allocate the continuous memory larger 128k for DMA process. But i can't used kmalloc() function for allocate the memory larger 128KB. allocate the continuous memory larger 128k for DMA process.
View 1 Replies
View Related
May 14, 2011
I need to write script to look for the presence of memory allocation calls without corresponding calls to free the memory
View 5 Replies
View Related
Jan 9, 2010
The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?
View 1 Replies
View Related
Apr 30, 2010
i've just installed a fresh copy of 10.04 on my laptop, and, with the default "ambiance" theme, i can't change the pointer to dmz-black: i click on it to select it, but it stays white, even after rebooting and stuff.
View 4 Replies
View Related
Jan 31, 2011
I want to change my computer back to its original self cause i have two computers in Ubuntu OS and i really just want one on it. My question is how can i change it back? I had Windows XP before ubuntu.
View 3 Replies
View Related
Jul 10, 2011
I just upgraded from Ubuntu 10.10 to 11.04, and it doesn't seem like there is much diffrent, shouldnt I have a desktop like this:
when mine looks like this (the same it was for 10.10):
Do I have to enable something? I went to System>About Ubuntu. And I am running 11.04 so I'm not sure why it is like it is.
View 4 Replies
View Related
May 6, 2010
I just installed Kubuntu on my machine, but on returning to gde I still have the oxy-white pointer from kde. I went to preferences>appearance>themes>customize>pointer, and changed it back to DMZ White, yet the pointer still looks like oxy-white. I tried it with all of the different pointer options, but none of them will override oxy-white.
View 9 Replies
View Related
Jun 3, 2010
I am using Kubuntu 10.04. I am using the default theme. I would like to know where do i go to change the mouse cursor point type.
View 3 Replies
View Related
Sep 29, 2010
I am trying to change my mouse pointer icon. I have my computer looking like I want it to with the exception of the mouse pointer.
I found a guide here: http://ubuntuforums.org/showthread.php?t=77694
I installed gcursor, however it will not let me change anything. The Install Theme and Go to Theme Folder buttons do nothing. Could this be some sort of a conflict with Compiz?
P.S. I am running Lucid.
View 1 Replies
View Related
Nov 14, 2010
Where on earth does one go to change the "mouse pointer"? Every time I log into Ubuntu, I get an "X" pointer and have to change it to an "arrow" pointer.
View 3 Replies
View Related
Mar 18, 2010
For those of us in the US, last weekend we started daylight saving time (1 hour ahead). When I booted up my laptop on Sunday morning, the clock did not automatically update. I have a script to sync my clock with a public time server, so it was no big deal to run it. I did think it was odd that Slackware did not automatically adjust the clock.
My question is this: Is this expected behavior?
View 8 Replies
View Related
Aug 5, 2010
I created 2nd root (root2) by running useradd -o -u 0 root2 is it possible to deny root2 to change password of original root?
View 11 Replies
View Related
Mar 2, 2010
I installed Suse 11.2 recently, and i have my laptop hooked up to a HD monitor.
When i choose the HD monitor, if the resolution is low, lets say 1280x800, same as my laptop, its fine. I see the mouse pointer.
But as soon as i change the resolution to 1920x1080, the pointer disappears. Mouse functionality works allright. Right click/left click works fine, and i can see the buttons getting highlighted on mouse-ever.
But the pointer is gone.
View 4 Replies
View Related
May 15, 2010
I am using Ubuntu 9.10 for about three months now (I am a total greenhorn) . A few hours ago, I decided to add the KDE 4.4 desktop environment. I followed the procedure on this link. It was all in GUI, no terminal commands required. [URL]
Installed KDE and everything is fine except two problems.
1. The KDE mouse pointer has become default in GNOME and I just can't change it. Tried everything, changing theme, customising theme and even downloaded the "mouse pointer" app from Software Centre. Nothing works.
2. I am not able to upgrade anything using Kpackagekit. It keeps telling me I don't have authorisation, without asking for my password.
View 4 Replies
View Related
Jul 28, 2010
I was messing with appearances and inadvertently changed my mouse pointer. Currently it's big and red, I can't figure out how or where I need to be to change the mouse pointer back to normal.
View 1 Replies
View Related
Dec 26, 2010
Can one change the color of the box presented when you hold the mouse pointer over a object like scrolling through threads? The black box is a killer on my eyes.
View 4 Replies
View Related
Dec 7, 2009
On Debian Standard System I would like to is change /tmp directory from it's original /dev/hda8 to destination /dev/hdd5
Code:
Disk /dev/hda: 6448 MB, 6448619520 bytes
255 heads, 63 sectors/track, 784 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
[code]...
If I change /dev/hda8 to /dev/hdd5 and reboot the startx command fails to run.
View 7 Replies
View Related
Mar 21, 2011
Fresh install of 32-bit 11.3 on my father's computer.He needs me to enlarge the mouse pointer and/or make it a different color. I changed it in the settings/themes thing like you are supposed to, but it appears to only take effect in Mozilla.needs the larger mouse pointer for the entire system. Evolution appears to completely ignore the mouse theme settings.
View 1 Replies
View Related
Jan 3, 2010
I installed Ubuntu today and I have to say it's awesome, shortly after trying it I decided to remove XP, I had some problems I could solve myself but right now my "biggest" one is that I can't uninstall empathy, it may sound stupid but I totally need to take it out, I installed Pidgin and it works like a charm btw: I removed empathy from the ub soft center but it didn't change anything
I had a lot of questions but I resolved all of them in the middle of this post (= I have another question but it isn't as important, does anyone know how to set up the cube? I'm sure I'll end up turning it off but I want to try it
View 4 Replies
View Related
Apr 24, 2011
Is it possible to check if a pointer is deleted in C++ (using GDB)? For example:
Code:
a = new Thing();
b = a;
delete a;
// If all I have is the variable "b", how can I tell if it was deleted?
View 14 Replies
View Related
Mar 20, 2010
So far I have this:
Code:
int mm_init (mm_t *MM, int hm, int sz) {
int i;
[code]...
View 4 Replies
View Related
Jul 6, 2010
I'm trying to write a simple program that lists a menu and then asks you for your decision, and you can answer with a number or the name. However, I don't know how to add the second options (name).
View 14 Replies
View Related
May 19, 2011
#!/bin/bash
sed -n 8p file.txt
returns the 8th line to the StdOut.
If I assign the value to the variable line = $(sed -n 8p file.txt)
and now print it out with echo
echo $line
the line would be printed.
But what if the file has only 4 lines. What value would be assigned to the variable line?
I want to know that because I want to only print it if the value is "something", that is not null.
In Java for example I would do it like this...
String line = "";
line = reader.readLine(); // or anything else..
if(line!=null){
System.out.println(line);
}
How would I check if the value is not "null"(I don't know if bash knows null)
View 13 Replies
View Related