142 Topics

Member Avatar for
Member Avatar for gilly_kumar

Hi, After 7000-8000 loops, i.e after 2-3 days, there is a runtime error because malloc failed.We identified that the error was occuring malloc function tires to allocate ~250k bytes of data. Then on analysis, We listed few possible items where malloc could fail 1. Fragmentation 2. Memory overwrite or overflow …

Member Avatar for lich
0
302
Member Avatar for abhi_iips

what happens at memory level....when one object is assigned to another.... i have written 2 classes.....1st named base class mybase and a subclass named subclass.... now i create object of baseclass... mybase b = new mybase(); //and now i create object of subclass subclass c = new subclass(); b=c; now …

Member Avatar for bugmenot
0
128
Member Avatar for erementarz

Hi, I'm experiencing an OutofMemoryError exception while recursing through a tree with a large number of branches (30) but relatively small depth (5). Here's the basic idea of the code: I start growing the tree using a depth-first method, and after I reach the leaf node, I assign a value …

Member Avatar for Ezzaral
0
124
Member Avatar for slayer10

Ok, i have been making a chess game program, basically what it is is a chesspiece class and a chess board class, the chessboard class has an 8x8 2-d array of chesspiece objects, then i have my frame, my frame has a parallel 2-d array of Jtoggle buttons, when a …

Member Avatar for slayer10
0
98
Member Avatar for Dark_Knight

Hi. Below are two pieces of code. This first one works fine: [code] char str[] = "Hello World"; char *b; b = &(str[3]); *b = '3'; printf("%s\n", str); [/code] However this second one results in a segmentation fault. [code] char *str = "Hello World"; char *b; b = &(str[3]); *b …

Member Avatar for WolfPack
0
323
Member Avatar for Brent.tc

I have newly made my bcstring class, and it is having some strange errors. I have given it the ability of dynamically allocating memory. If the memory to be allocated is already allocated, nothing happens (correct/non-problematic); If the memory to be allocated is greater than that that is allocated, and …

Member Avatar for Ancient Dragon
0
181
Member Avatar for Brent.tc

I was wondering which would be better to use for the allocation of memory. The memory that is being allocated will almost certainly have to be reallocated several times. I am making a string class (how original :) and I am going to give it dynamic memory allocation (whether or …

Member Avatar for Narue
0
181
Member Avatar for asilter

i'm sending a NULL pointer of type unsigned char to a function. i allocate space for this pointer in the function and return nothing. [code] unsigned char ucBufr = NULL; Allocation(ucBufr); [/code] [code] void Allocation(unsigned char * ucBufr) { /* nDataSize and ucData is got from a file here. */ …

Member Avatar for Hamrick
0
139
Member Avatar for Covinus

I want to make a program that monitors your cpu, virtual and physical memory. Can anyone give me a head start. Is there a standard function to know cpu usage, how much memory left, etc Whats the right term to search for monitoring computer resources in c? I tried some …

Member Avatar for Covinus
0
155
Member Avatar for JRM

all is not always what it seems. I found out the hard way that there is a very big difference between a copy and a direct assignment . [code=cplusplus] char* a = new char(); char* b = new char(); cin.getline(a,10,'\n'); strcpy(b,a); //ok makes a SEPARATE copy a=b; //This seems to …

Member Avatar for Narue
0
168
Member Avatar for Sukhbir

Hi All, Please expain me, in below giving statements which one is efficient. int i=0; i = i + 1; or i++; 2. In We Allocate the memory using malloc. between somewhere after allocating memory if our programming crashed.Then Allocated memory will be immedately freed by OS or OS will …

Member Avatar for Narue
0
142
Member Avatar for Micko

Hello guys, It's been a while since I last time posted in this forum. I have strange problem regarding matrix allocation. I was asked to write code that includes 2D array dynamic allocation. I write two version of matrix allocation. Here is in my opinio relevant part of the code: …

Member Avatar for Micko
0
188
Member Avatar for laconstantine

Hi Everyone, I have the following function, char* sample1() { char *p = "Israel"; return(p); } //in this case the memory storing india is not destroyed at the end of the function, indicating that it wasn't stored in the stack meant for the function call. However, the following function causes …

Member Avatar for Narue
0
162
Member Avatar for bcramer

Hi! I hope you could help me with this one. I simplified the code of my program to its basic problem, and the problem is that I do not seem to understand why this program does not release its memory. I check it at the moments of the [inlinecode]getline[/inlinecode]'s, using …

Member Avatar for Salem
0
141
Member Avatar for applegrew

(I have 2 queries) I have made a html parser but the memory leaks, as it seems from the message below; is killing me. I am getting this message from gdb debugger (cygwin build). Heap block at 003D2CA0 modified at 003D2CB3 past requested size of b Also now not all …

Member Avatar for applegrew
1
1K
Member Avatar for SAZAR

I have windows XP. I've bought 2GB of RAM recently (2x1GB RAM DDR Dual Channel). Ever since: Macromedia Extreme 3D (E3D) can't render scenes (says "Out of memory"), or computer can't even load the application (says "Insufficient memory to run the application" or something like that)... What is the deal …

Member Avatar for jbennet
0
111
Member Avatar for Covinus

[code] a=(char*) malloc(sizeof(15)); b= bmfh.bfType; sprintf(a, "bfType: %d", b); TextOut (hdc, 0, 0,a , strlen(a)) ; delete[] a; a=(char*) malloc(sizeof(15)); b=bmih.biBitCount; sprintf(a, "bitCount: %d", b); TextOut (hdc, 0, 20,a , strlen(a)) ; [/code] is it necessary to leave the a undeleted when i gave it another value or i should …

Member Avatar for Covinus
0
143
Member Avatar for laconstantine

I just started mess with Memory at c++ so i am very confused now, and this is why i am asking 3 questions that made me confuse so much. 1. Look at this: char *str = "Literal String"; Here we are creating a char pointer called str then we are …

Member Avatar for Narue
0
355
Member Avatar for l-o-s-t

I defined a struct that has the format: [CODE] struct node{ char *str; int key; link next; }; [/CODE] and I have a list of this type, when I try to do this [CODE] free ( list -> str ) [/CODE] the program terminates :-| how can I free the …

Member Avatar for l-o-s-t
0
145
Member Avatar for Nholdamek

I've been building this program to interface with the Swis ephemeris library. It's working beautifully, except for one thing. OK, I need to be able to specify it to retrieve information about multiple planets, such as longitude, speed, etc. So I have a function that parses the command line parameter …

Member Avatar for Nholdamek
0
319
Member Avatar for Joe689

[code] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] **Point_in_Range;[/COLOR] sub_vol_size_xi =512; sub_vol_size_yi =512; sub_vol_size_zi=512; Point_in_Range=([COLOR=#0000ff]int[/COLOR]**)malloc([COLOR=#0000ff]sizeof[/COLOR]([COLOR=#0000ff]int[/COLOR]*)*(sub_vol_size_xi*sub_vol_size_yi*sub_vol_size_zi)); cout<<"Get Here1"<<endl; [COLOR=#0000ff]for[/COLOR](j=0;j<sub_vol_size_xi*sub_vol_size_yi*sub_vol_size_zi;j++){ cout<<j<<endl; Point_in_Range[j]=([COLOR=#0000ff]int[/COLOR]*)malloc([COLOR=#0000ff]sizeof[/COLOR]([COLOR=#0000ff]int[/COLOR])*3); } [/code] What is the memory problem.... been stuck on this for a little while now. thanks in advance

Member Avatar for Salem
0
294
Member Avatar for degamer106

If I have a dynimcally allocated array of objects and each of these objects contains a pointer to a string, when I use the 'delete' function to return memory, do I have to go through each array element and free each string individually or does the 'delete' take care of …

Member Avatar for Salem
0
148
Member Avatar for tehloki

Hey, I have here a piece of code that works in parts but does not work together. If I test all three parts at once, I get a segmentation fault immediately before the program is supposed to test for a (null) value in the string array. However, if I comment …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for tori

Hi, I use: WINXP SP2 P3 866 1GB SDRAM 20GB ide HD 5400 rpm Windows choose to make the pagefile 1.5 times the Ram In my case 1.5GB I usually use the machine for web browsing and office applications. My question is whether it is really necessary to use this …

Member Avatar for tori
0
159
Member Avatar for Harshita_garg

Hi Frenz! Please go through the following program made for matrices:- [code=cpp] template <class T> class Matrix { private: int dim1;int dim2; T **mtx; public: Matrix(int a) { dim1=dim2=a; mtx=new T*[dim1]; for(int i=0;i<dim1;i++) mtx[i]=new T[dim2]; } ~Matrix() { delete []mtx; } Matrix<T> operator +(Matrix<T> M) { Matrix C(dim1,dim2); for(int i=0;i<dim1;i++) …

Member Avatar for Harshita_garg
0
163
Member Avatar for bhushanm

hi, in my code i am creating a tree, which have a 20 levels and and each level we have 10 nodes. i.e every node can have a 10 children. for them i am allocating memory for each node. each node is stracuture which occupies the memmory around 40 bytes. …

Member Avatar for jim mcnamara
1
192
Member Avatar for ep2002

Hi all, I have quite a bit of memory in my computer & it's still never enough. Someone recommended I get a memory manager software program. What do you guys recommend? Thanks Michelle

Member Avatar for caperjack
0
365
Member Avatar for Fasola

What's the difference between Static and Dynamic Memory Allocation and what are the advantages and disadvantages of them both?

Member Avatar for samaresh
1
598
Member Avatar for dev.cplusplus

Hi, I'm looking for a function that will convert CString to char*, I found the function [code] char* ConvertToChar(const CString &s) { int nSize = s.GetLength(); char *pAnsiString = new char[nSize+1]; memset(pAnsiString,0,nSize+1); wcstombs(pAnsiString, s, nSize+1); return pAnsiString; } [/code] The problem is you cann see that there is the use …

Member Avatar for Ancient Dragon
0
179
Member Avatar for steve65

Hi all! I have been having the hardest time trying to get memory to release from an application I am developing. I know I could have written the code below without the classes but I wanted to makes sure that I understood how to pass references and not values in …

Member Avatar for alc6379
0
193
Member Avatar for srishekh

Respected Sir/madam, Could you help me in understanding the dynamic memory allocation for a 3D matrix. I have attached the file.I am allocating memory dynamically for the 3D matrix,which i am using in my project. As per the concept when new is unable to allocate the specified memory it will …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for lazobriduck

Recently I have found an odd memory problem in Windows XP. Several day's ago whenever I checked the usage in task manager it would show as around 190mb, increasing when opening programs and shrinking back when they were closed. I was going through some XP tweak sites to try and …

Member Avatar for MartyMcFly
0
231
Member Avatar for SpS

[QUOTE=narue]Well, you didn't specify how it didn't work, but on one of my compilers, there's a run-time assertion if the allocation size exceeds a certain limit, and 4294967295 is beyond that limit. Such an assertion throws up a dialog box and aborts the program, which could look like an uncaught …

Member Avatar for SpS
0
137
Member Avatar for cutenature

I am trying to free a memory in the main which has been allocated in a sub-function. Is this possible and am i doing this in the right fashion. The code sample is: char* SubFunction() { char *ptr= NULL; char **values; ptr= (char *)calloc( 100, sizeof( char ) ); if(ptr== …

Member Avatar for Chainsaw
0
125
Member Avatar for littletimmy

Hi all, If I want to check if memory has already been alocated to a pointer, and if it has I wnat ot delete it, is this how it would work? theGraph = new MyObject[size()]; if (theGraph != 0){ // or even NULL delete[] theGraph; } This seems intuitive to …

Member Avatar for Dave Sinkula
1
222
Member Avatar for FireNet

I am currently developing a Snake game with multiplayer support(Not Network based) with unlimited no of players(ok limited by the keys and RAM and processor speed but not restricted). I developed a nice concept of key maps to load all controller information into memory and handle it there.This works just …

Member Avatar for FireNet
0
256
Member Avatar for Levi

Hello, very new here. I have a few questions actually but the main one involves RAM...I'm currently making plugins for the RPGToolkit (I don't know if any of you use it or know what it is) and a person who has "hired" me to make plugins for a game he …

Member Avatar for infamous
0
221
Member Avatar for oalee

This just happened yesterday without me doing anything at all... here's the problem: I start up win2k, then I log onto it, then an error message appears that says "your system has no paging file or your paging file is too small." then it gives instructions on how to adjust …

Member Avatar for TallCool1
0
181
Member Avatar for pgwolfe

[font=Times New Roman][size=3]Throughout the day, I am constantly opening and closing programs (just like everyone else). Is there a good program that details the programs that are loaded into my PC

Member Avatar for crunchie
0
174
Member Avatar for Valmian

Hello, I really don't know if this is more of a Mac of C++ question but.. I am doing a loading of a file with short CSVload (char * filename) //called from main { //openning a file and checking if it exists FILE * datafile = NULL; if ((datafile=fopen (filename, …

Member Avatar for Valmian
0
231
Member Avatar for Valmian

Hello, I really don't know if this is more of a Mac of C++ question but.. I am doing a loading of a file with short CSVload (char * filename) //called from main { //openning a file and checking if it exists FILE * datafile = NULL; if ((datafile=fopen (filename, …

Member Avatar for subtronic
0
226
Member Avatar for ttomm46

hi i have a win98SE OS. 512mb of ram. why 512 when only 256 is available i Don't know Anyway is there actually a memory manager that actually works? Tom :eek:

Member Avatar for caperjack
0
155

The End.