:-( unfortunatelly...
temporarily i solved it in this way:
DO WHILE (.NOT.ALLOCATED(MX))
IF (.NOT.ALLOCATED(MX)) ALLOCATE (MX(1:NG,1:NG,1:NG), STAT = ERR_ALLOC)
IF (ERR_ALLOC.NE.0) NG = NG - 50
END DO
WRITE (0, *) 'ALLOCATED ', NG**3 / 1000000, ' MEGABYTES.'