• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cross-development with Visual Studio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cross-development with Visual Studio


  • Subject: Cross-development with Visual Studio
  • From: Raymond Rabu <email@hidden>
  • Date: Thu, 05 Aug 2004 11:45:16 -0600
  • Organization: University of Saskatchewan

I have created a C++ project in Xcode and it seems to run just fine. I load
an image, do some computation and it takes up to 50MB or so of memory while
running.

However, when I compiled the same project in MS Visual Studio, I find that
my memory consumption runs up over 300MB !! Does anyone have any idea why
the same code would behave so differently? I thought C++ was fairly standard
across these compilers (at the level I'm using it anyway).

I've traced it down to this line of code:

	Matrix<Vector<float> > fD = Matrix<Vector<float> > (1024, 768);

It seems that allocating this matrix costs lots more under Visual Studio
than under Xcode. Anyone with experience in this have any ideas?  I
apologize if I am posting this to the wrong list.



The relevant pieces of the objects here are defined as:

-----------------
template<typename T>
class Vector
{
private:
	T *array;
	int mCount;

public:
	Vector() { array = NULL; mCount=0; };
	Vector(int i) { array = new T[i]; mCount=i; };

	T &operator[](int i) { return array[i]; };

	~Vector() { if(array != NULL) delete [] array; };
};

-----------------
template<typename M>
class Matrix
{
private:
	Vector<M> *matrix;
	int mRows;
	int mColumns;

public:
	Matrix() { mRows=0; mColumns=0; matrix = NULL; };
	Matrix(int i, int j)
	{
		mRows = j;
		mColumns = i;
		matrix = new Vector<M> [mColumns];
		for(int k=0; k<mColumns; ++k)
			matrix[k] = Vector<M>(j);
	};
	Vector<M> &operator[](int i) { return matrix[i]; };
	~Matrix() { if(matrix != NULL) delete [] matrix; };
};
------------------
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • RE: Cross-development with Visual Studio
      • From: "Bill Lowrey" <email@hidden>
    • Re: Cross-development with Visual Studio
      • From: Markus Hitter <email@hidden>
    • Re: Cross-development with Visual Studio
      • From: Vincent Robert <email@hidden>
  • Prev by Date: Re: Xcode does seem hard on newbies(was Xcode release notes)
  • Next by Date: Re: OT: cvs project info
  • Previous by thread: Re: xcode 1.5 release today?
  • Next by thread: Re: Cross-development with Visual Studio
  • Index(es):
    • Date
    • Thread