Advertisement

Very strange problem! Need help!

Started by July 05, 2000 11:51 AM
10 comments, last by Gandalf 24 years, 5 months ago
I can´t run my program on a Compaq 550 Mhz computer in Win98 mode! On my other 2 computers, a DELL 300 Mhz win2000 and a p2 400 mhz win98, it works fine both in release and debug. But on the compaq it only work in debug. In release I can´t mange to create a dialog which is critical to run the program. And a nother strange thing: Look at sample from my code!
                
SHOW("Nothing wrong so far. Now: memset");

	// Initialize objects

	m_Object = new OBJECT[m_usCubes];

	//ZeroMemory(m_Object, sizeof(OBJECT)*m_usCubes);
   memset(m_Object, 0, sizeof(OBJECT)*m_usCubes);
	// Angle between objects in radians.


	SHOW("It works!");
                
On my DELL win98 computer both Messageboxes show up in both release and debug mode, but on the compaq computer it only works in debug mode ! In release mode something happend between the messagebox calls. I get crazy If somebody know why please, please... Gandalf the White
You'll find a golden ring... Edited by - Gandalf on 7/5/00 11:53:17 AM Edited by - Gandalf on 7/5/00 11:53:55 AM Edited by - Gandalf on 7/5/00 11:54:24 AM
Gandalf the Black
m_Object is a pointer, right? You should also test the return value of memset().

- Muzzafarath

Mad House Software
The Field Marshals

Edited by - Muzzafarath on July 5, 2000 1:50:41 PM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Advertisement
If OBJECT is a class you are hammering any virtual functions that may be defined.

The first entry in an instantiated class is the virtual table. This table contains function pointers. it also contains a function pointer to your vurtual destructor.

You should NEVER NEVER NEVER NEVER NEVER NEVER and I repeat NEVER blast the memory the class uses. If you want to initialise all the class members to zero, then do it manually in the constructor.





--------------------------
Carpe Diem
D.V.Carpe Diem
quote:
If OBJECT is a class you are hammering any virtual functions that may be defined


m_Object is a pointer to this structure.

            struct OBJECT{	float fXPos; // Objects current x positon	float fYPos; // Objects current y positon	float fZPos; // Objects current z positon	unsigned char ucRotAx; // 0 == x, 1 == y, 2 == z	unsigned char ucBitmapNr;};            


quote:
m_Object is a pointer, right? You should also test the return value of memset().


The program crash in the call to memset. But only in release build and only on one compaq computer...

Gandalf the White

You'll find a golden ring...


Edited by - Gandalf on July 6, 2000 3:11:18 AM
Gandalf the Black
Hi!

what is the value of m_Object after the ''new''? If it''s NULL then memsetting will be BAD. It''s kinda hard to tell, since it''s still unclear WHERE the program crashes.

Ciao,

MK42
Do you get the same results when you use malloc?

What compiler are you using? Microsoft optimization is notoriously flaky. Is your module being optimized? Some optimizations are ''dangerous'' and don''t work well with certain coding styles. Try making a release with no optimization.

--------------------------
Carpe Diem
D.V.Carpe Diem
Advertisement
It failes to allocate memory:

m_Object = new OBJECT[m_usCubes];

But why?

Gandalf the White

You'll find a golden ring...
Gandalf the Black
I have tried to diable optimization without succes.

Gandalf the White

You'll find a golden ring...
Gandalf the Black
Can somebody understand this?

It´s really crazy! It´s strange as hell!

Gandalf the White

You'll find a golden ring...
Gandalf the Black
1. What is the value of m_ucCubes?
2. Check to make sure the correct libraries are used (ie release libs on release and debug on debug).
3. Check to make sure the windows DLLs are the correct versions.
4. Try running another program on the compaq and then, at the saem time, running the release version. This will tell you if there is a memory problem.

This topic is closed to new replies.

Advertisement