C++ :: Way To Use Debugger To Log Addresses Of Data It Allocated On Heap

Sep 19, 2014

I used a heap viewer to check for memory leaks. I have many of them and its hard to find out where it is not being freed. Is their a way to use the debugger to log the addresses of the data it allocated on the heap. This way I can trace it back. Or is their any other way to fix memory leaks properly.

View 4 Replies


ADVERTISEMENT

C :: Save Data To Arrays Defined In Main Using Their Addresses

Dec 30, 2013

so i have two classes ( main and another one ask ) in main i have defined 3 arrays (char drivers[250] ,offences[250] , owners[250]) and also included their pointers ( char *drivers_ptr,*offences_ptr,8owners_ptr)my problem is that i need to set values (actually 1 string of 250 chars to each of these arrays BUT from the class ask without making these arrays global -as this is prohibited by my university exercise !- )

so my question is how will i manage to save data to the arrays that i have defined in main using their addresses(through the pointers of each one that i have passed to the ask class) from the ask class ?

View 4 Replies View Related

C++ :: Copying Data Allocated By New Object

Dec 21, 2013

I have an abstract class Base, with derived classes Derived1, Derived2, etc. I don't know how many there are. So, I have declared an object of Derived like so:

Base* der1 = new Derived1(/* constructor details */);

That gets passed to a function, which modified the data contained by this pointer. However, I need to keep the data from the object, which means that I need to copy the data somehow. The problem is, this copying needs to be done within the function, due to the requirements of the program. I do not know what type the object is, This function will need to reset this data potentially hundreds of times, so I can't just provide lots of objects, as either the function will run out of objects to call or I will run out of space in memory.

How would I create a copy of this, so that I would be modifying a temporary object that could be deleted and I would keep the data that I started with?

View 4 Replies View Related

C++ :: SDL Won't Detect Debugger

Sep 2, 2013

Current compiler doesn't have correctly defined debugger!

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

Create new parser for project 'Test'

Project 'Test' parsing stage done!

View 4 Replies View Related

C++ :: Watch Elements Of A List In Debugger?

May 11, 2014

How can i look into the element that are pushed into the list. Something like listPointer[0].heapPointer,50

class CA{
public:
CA(void);

[Code].....

View 3 Replies View Related

Visual C++ :: How To Use A Different File For The Source In The Debugger

Nov 3, 2013

Visual studio 2012

I have a project that has a few .asm files (assembly language code), I have the compiler/assembler set to create a list file for the assembly code and would like the debugger to use the .lst file for the source instead of the .asm files because in the .asm files the macros are not expanded like they are in the .lst files which makes debugging difficult sometimes.

View 1 Replies View Related

Visual C++ :: Can Create Graphical Extension For VS 6.0 Debugger

Feb 8, 2013

I'm digging an old project and i can't switch to a newer visual studio.

I want to plot float data array during debug.

I know some IDE's have such option. There is a separate window in which we can plot data.

Can I write such plugin for Visual Studio 6.0 using visual studio SDK?

Does it support 6.0 version?

View 1 Replies View Related

Visual C++ :: Program Runs ONLY If Debugger Is Attached

Mar 13, 2014

I have an interesting (and incredibly frustrating) problem where my application runs fine, but ONLY when a debugger is attached to it.

I can build in both Debug or Release and double clicking the execuable causes it to crash before the window is drawn. However if I launch from the IDE (VS2010), again in both Debug or Release mode, the application runs perfectly fine.

How to debug in this situation.

I am using VS2010 in Windows 7, C++ with MFC. This is an application which has been migrated from VC++ 6 to VS2010. Note, it works perfectly when built from VC++ 6.

View 8 Replies View Related

C++ :: Debugger Crashes When Break Point Is Inside A Function

Aug 4, 2013

So, I have this code:

...
MakeTexture((char*)ilGetData(), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT));
...

And it compiles fine and, supposedly, works fine too, but when I try to put a break point inside the MakeTexture fuction gdb just goes crazy, it freezes and starts alocating memory until it reaches like 30+ mbs, and after that codeblocks freezes and I have to terminate the gdb process to return everything back to normal.

Now, another weird thing is that this only happens if I pass (char*)ilGetData(), if I pass something like NULL to the function, this doesn't happen.

Oh, also, the MakeTexture function is this:

int MakeTexture(char *pxData, unsigned w, unsigned h)
{
return 0;
}

View 2 Replies View Related

Visual C++ :: Watch Window No Longer Shown In Debugger

May 23, 2013

Visual c++ 2010 Express

Somehow the watch window is no longer shown in the debugger. It used to be available and I am stopped at a breakpoint.

Is there a way to turn it back on or restore it?

View 4 Replies View Related

C :: Check Addresses On Equality Possible?

Sep 18, 2014

I was wondering if it is possible to check if two addresses, so pointers are equal.I was saving the address of an array, and later wanted to identify it by the address, so if my area has the address: int *my_array; // is equal to: 0x1e9aa3a2c ...Later when I go through a list of pointers like:

list=
0x1e9c7e060
0x1e9ba6640
0x1e9aa3a2c <== my address
0x1e9aa3a2c

I want the third one to be equal to my list, but with == it didn't work for me.

View 3 Replies View Related

C# :: Looping Through A Range Of IP Addresses

Feb 6, 2014

I want to take a starting IP on a local network, and loop through to an ending IP on a local network, pinging all the IP addresses in between. For instance, ping all IP addresses between 192.168.1.1 - 192.168.1.255 (user enters desired starting IP and ending IP in text boxes).

I have the ping functionality working, and i can make it all work with lots of messy string parsing.. but it seems sloppy to me.

I have to split the strings (start and end IP) to get the last octet, then subtract to get the range of IPs. Then loop through, adding 1 to the last octet, and converting back to a string each time.

The C# Ping class can use either a string or an IPaddress for its Send method. If I use IPAddress, I just have to convert it from the text box it originates in, but the adding 1 to the last octet in the loop is a hassle.

Anyway, I guess the only question I have is, if you had to loop through a range of IP addresses, how would YOU do it?

public Job(string ipStartIn, string ipEndIn) {
long ip1 = Convert.ToInt64(ipStartIn);
long ip2 = Convert.ToInt64(ipEndIn);
IPStart = new IPAddress(ip1);
IPEnd = new IPAddress (ip2);
this.deviceAlive = false;

[Code] ....

View 14 Replies View Related

C/C++ :: Hashing Hexadecimal Addresses?

Feb 25, 2015

I'm taking a university course and one of our first projects dealing with C is to write a hash table (with chaining as a collision solution) that will hash loads of hexadecimal values into the table. I'm just brain storming right now but how practical is it to hash the values by converting them to decimal and working with that value in another function to organize the values? I'm thinking this might take a lot of time and memory because our code will be tested with text files that could have a few lines of hexadecimal addresses or millions of them.

View 2 Replies View Related

C++ :: Compare Memory Addresses On The Stack?

Dec 4, 2014

Jumping into C++, question 5 page 181:

"Write a program that compares the memory addresses of two different variables on the stack and prints out the order of the variables by numerical order of their addresses.

Does my solution look correct

Code:
#include <iostream>
using namespace std;
int main() {
int one = 1;
int two = 2;
if (&one < &two)
cout << one << " " << &one << " " << two << &two << endl;
else
cout << two << " " << &two << " " << one << " " << &one << endl;
}

View 6 Replies View Related

C :: Can Get Memory Addresses From Compile Time?

Sep 1, 2013

My question is this: Is it possible to determine where functions are stored at compile time, so that at run time you can pass the memory address as a pointer to the interrupt handler so that it can directly call the function at memory location 'X'?

The newest project I'm working on would require to either somehow capture these addresses or to find a work-around so that instead of passing the pointer to the interrupt handler, the software would then need to be able to be non-interruptable.

View 2 Replies View Related

C++ :: Memory Addresses Of Pointers To Structs

Apr 19, 2014

I have this struct declaration to create a linked list

struct node {
string y;
node* next;
};

If I create a linked list of 3 nodes

A->B->C->NULL

A->y is "a"
B->y is "b"
C->y is "c"

Since they are consecutive in memory. How far apart are the strings in memory?

I tried doing something like

int n = &(head->next->x)-&(head->x);

The problem is that I got 6 while debugging and 2 otherwise.

View 1 Replies View Related

C++ :: Define Statement Assigning Addresses

Sep 10, 2013

I dont understand the pointers or the parenthesis.

#define PORTA *(unsigned char volatile *)(0x0000)

View 2 Replies View Related

C/C++ :: Passing Structure Addresses To Functions

Mar 20, 2014

What this is, is a more recent assignment and my question is if my errors are directly related to passing structure addresses to functions. I've tried several syntax variations at the beginning of my loops such as this one:

while (choice != "Q" || "q")

But the loops will not run since I introduce polar to rectangular and the choice element. My last working code was rectangular to polar and all of it worked fine.

#include<iostream>
#include<cmath>
using namespace std;
//structure declarations
struct polar
{
double distance; //distance from origin
double angle; //direction from origin

[Code] ....

View 14 Replies View Related

C++ :: Do A Recursive Implementation Of A Heap

Apr 19, 2013

So I'm going through and trying to do a recursive implementation of a Heap. I keep getting access violations for some reason on my sifts (_siftUp) - even though I'm trying to insert into sub[0] (currSize = 0 in the constructor). I don't think either of my sifts are implemented correctly, are they?

Here's my Heap:

Code:
#ifndef HEAP_H
#define HEAP_H
//**************************************************************************
template<typename TYPE>

[Code].....

View 5 Replies View Related

C++ :: Array To Heap Tree

Jun 3, 2012

If I have an array, and want to make a heap tree out of it using make heap and sort heap, how would I do it? I'm struggling because I didn't take any course in data structure.

I tried googling stuff and I got to the following:

Code:
#include <algorithm> // for std::make_heap, std::sort_heap
template <typename Iterator>
void heap_sort(Iterator begin, Iterator end) {
std::make_heap(begin, end);
std::sort_heap(begin, end);
}

The thing is, I don't know what's the "Iterator" doing exactly and what's begin/end, how can I use arrays with the former piece of code?

View 14 Replies View Related

C++ :: Initializing Pointers To Memory Addresses Or Values?

Aug 31, 2014

What is the difference between initializing pointers to a memory address using the address operator like int *pointer = &x; or initializing it to a value like int *pointer = x; .. in other words how does p and q point to the same memory address in:

const int ARRAY_LEN = 100;
int arr [ ARRAY_LEN ];
int *p = arr;
int *q = &arr[0];

View 4 Replies View Related

C# :: Are Methods Stored In Heap Or Stack?

Jan 29, 2012

I know that memory addresses in the stack can contain either values or references to other memory addresses, but do these memory addresses also contain methods or are the methods themselves located in the heap?

The confusion comes from the fact that in C# a delegate variable can be assigned either a method's identifier, an inline function, a lambda expression, or a new instance of the delegate type with the method's identifier passed as an argument to the constructor. My guess is that assigning the method's identifier directly to the delegate variable is just a simplified way of calling the delegate type's constructor with the method's identifier as an argument to the parameter, something that the compiler handles for you.

But even in this last case, the delegate variable is said to point toward the method itself. In that case, does it mean that methods are stored in the heap, just as reference type values are?

View 2 Replies View Related

C++ :: How To Take Size Of Array And Initialize It On Heap

Feb 6, 2014

I am creating a class that has a private array on the heap with a constructor that takes the size of the array and initializes it on the heap. Later I have to make a deconstructor delete the space and print out free after.In my code, I was able to heap a private array and make a deconstructor, but I don't know how to take the size of the array and initialize it on the heap. My guess is this:

int* size = new int();

Also when you initialize size on the heap, don't you also have to delete it too? If so, where, in the code, do you do that? Here is my code so far.

Class Student {
private:
int size;
int* array = new int[size];
public:
Student(); // Constructor
~Student(); // Deconstructor

[code]....

How do you make a constructor that takes the size of the array and initializes it on the heap

Student::~Student()
{
delete[] array;
cout << "Free!" << endl;
}

View 1 Replies View Related

C++ :: Build Min Heap With No Repeating Values

Jul 10, 2013

10,11,20,1512,22,24,19,22

i want to write a c++ program to build min heap which gets above values from user. remember this program should not alloduplicate values to enter. it should discard duplicate values.

View 11 Replies View Related

C++ :: Creating A Heap Template Class

Sep 16, 2014

I recently posted a question related to creating a heap template class. The ultimate goal is to create a series of classes that serve a purpose that was overlooked in the Qt library that I need for my current project.

The current "end goal" is a PriorityQueue template that uses a comparer class which is inherited from a "template interface". Basically a pure virtual class template. Perhaps that is the mistake to begin with but hopefully not. (Is this a valid approach?)The problem I am getting is that when I compile the code, it says my derived comparer class is abstract.

I will include all related classes here. I doubt it is relevant but the templates and the classes based off them are in different namespaces.Here is the comparer "template interface":

// in global namespace
template<class T>
class IIMQOBJECTS_EXPORT IQComparer {
virtual int compare(T& a, T& b) = 0;
virtual bool equals(T& a, T& b) = 0;
virtual bool isGreaterThan(T& a, T& b) = 0;
virtual bool isLessThan(T& a, T& b) = 0;
};

Here is the class that is supposed to be non-abstract but isn't recognized as such:

// in the application namespace AND IN SAME project that has the NetEventInfo class
// all functions ARE defined/implemented in a cpp file
class APPCORE_EXPORT NetEventInfoComparer : ::IQComparer<NetEventInfo*> {
public:
NetEventInfoComparer();
~NetEventInfoComparer();

[code].....

View 6 Replies View Related

Visual C++ :: TCP/IP Program - Display All IP Addresses That Are Connected To Client

Mar 12, 2013

I need to create a TCP/IP program using visual studios MFC that displays all client's IP addresses that are connected to the client.

The MFC application just has a list box and a button. The client can be a simple console application. When the button is clicked, the list box gets populated with all ip addresses of connected clients.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved