Dynamiczna tablica dwuwymiarowa XMMATRIX - Unhandled exception at 0x01080AAA

0

Witam
Obecnie próbuję stworzyć dynamiczną tablicę XMMATRIX, kompilacja przebiega prawidłowo, jednak po uruchomieniu otrzymują komunikat:

Unhandled exception at 0x01230AAA in PRT.exe: 0xC0000005: Access violation reading location 0x00000000.

Przed main:

short const int EKx = 10;
short const int EKEx = 6;
short const int EKCx = 3;
short const int EKy = 1;
XMMATRIX ** menuU = new XMMATRIX * [EKx + 1 + EKEx + 1 + EKCx + 1];

W main:

	for (short int DM = 0; DM < EKx + 1; DM++){

		menuU[DM] = new XMMATRIX [EKy];

	}

	menuU[0][0] = XMMatrixIdentity();
	menuU[0][0] = XMMatrixScaling( BlokY, BlokX, 1 ) * XMMatrixTranslation( 1, 1, 0);

Błąd nie występuje tylko w momencie gdy:

	menuU[0][0] = XMMatrixIdentity();
	menuU[0][0] = XMMatrixScaling( BlokY, BlokX, 1 ) * XMMatrixTranslation( 1, 1, 0);

Zamienię na:

	menuU[1][0] = XMMatrixIdentity();
	menuU[1][0] = XMMatrixScaling( BlokY, BlokX, 1 ) * XMMatrixTranslation( 1, 1, 0);

Co jest przyczyną tego błędu?

0

Przydzielasz na [EKx + 1 + EKEx + 1 + EKCx + 1] wierszy, z których inicjalizujesz tylko : DM < EKx + 1

0

Po dodaniu:

	for (short int DM = 0; DM < EKx + 1; DM++){

		menuU[DM] = new XMMATRIX [EKy];

	}

	for (short int DM = EKx + 1; DM < EKx + 1 + EKEx + 1; DM++){

		menuU[DM] = new XMMATRIX [EKEy];

	}

	for (short int DM = EKx + 1 + EKEx + 1; DM < EKEx + 1 + EKx + 1 + EKCx + 1; DM++){

		menuU[DM] = new XMMATRIX [EKCy];

	}

Efekt jest ten sam, tylko początek komunikatu zmienił się minimalnie:

Unhandled exception at 0x01350AEC

0

Bardzo dziękuje za pomoc :)
Po przeczytaniu tamtego tematu, poszukałem trochę jeszcze i znalazłem funkcję _aligned_malloc, która rozwiązała mój problem.

1 użytkowników online, w tym zalogowanych: 0, gości: 1