X-NUCLEO-IHM07M1with Arduino Mega2560

Hi Guys!
I tried to control a 3-phase hall sensored brushless dc motor 24V operating voltage with the X-NUCLEO-IHM07M1 board, based on L6230 3 half-bridged motor controller, and while i compiled my code, i get this error message:

"Arduino: 1.8.9 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

fatal error: out of memory

runtime stack:
runtime.throw(0x8897f9, 0xd)
/home/jenkins/go1.10.2-patched/src/runtime/panic.go:616 +0x6b
runtime.largeAlloc(0x4c57d, 0x820101, 0x822ce0)
/home/jenkins/go1.10.2-patched/src/runtime/malloc.go:828 +0xdc
runtime.mallocgc.func1()
/home/jenkins/go1.10.2-patched/src/runtime/malloc.go:721 +0x39
runtime.systemstack(0x0)
/home/jenkins/go1.10.2-patched/src/runtime/asm_386.s:464 +0x5e
runtime.mstart()
/home/jenkins/go1.10.2-patched/src/runtime/proc.go:1175

goroutine 1 [running]:
runtime.systemstack_switch()
/home/jenkins/go1.10.2-patched/src/runtime/asm_386.s:418 fp=0x12da1ae0 sp=0x12da1adc pc=0x44f740
runtime.mallocgc(0x4c57d, 0x802a20, 0x12da1b01, 0x83e080)
/home/jenkins/go1.10.2-patched/src/runtime/malloc.go:720 +0x67b fp=0x12da1b34 sp=0x12da1ae0 pc=0x40ee2b
runtime.makeslice(0x802a20, 0x4c57d, 0x4c57d, 0x0, 0x12b18000, 0x12b439a0)
/home/jenkins/go1.10.2-patched/src/runtime/slice.go:61 +0x59 fp=0x12da1b48 sp=0x12da1b34 pc=0x43be19
bytes.makeSlice(0x4c57d, 0x0, 0x0, 0x0)
/home/jenkins/go1.10.2-patched/src/bytes/buffer.go:230 +0x61 fp=0x12da1b64 sp=0x12da1b48 pc=0x460441
bytes.(*Buffer).grow(0x7edee900, 0x4c57d, 0x7edee900)
/home/jenkins/go1.10.2-patched/src/bytes/buffer.go:144 +0x112 fp=0x12da1b8c sp=0x12da1b64 pc=0x45fed2
bytes.(*Buffer).Grow(0x7edee900, 0x4c57d)
/home/jenkins/go1.10.2-patched/src/bytes/buffer.go:163 +0x2d fp=0x12da1b9c sp=0x12da1b8c pc=0x46003d
io/ioutil.readAll(0x8e8ae0, 0x759593e0, 0x4c57d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/jenkins/go1.10.2-patched/src/io/ioutil/ioutil.go:34 +0x10a fp=0x12da1bc0 sp=0x12da1b9c pc=0x4f06ba
io/ioutil.ReadFile(0x7ebbd1e0, 0xaa, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/jenkins/go1.10.2-patched/src/io/ioutil/ioutil.go:73 +0xcc fp=0x12da1bec sp=0x12da1bc0 pc=0x4f081c
github.com/arduino/arduino-builder.targetFileChanged(0x7eea4000, 0x4c37d, 0x4c57d, 0x7ebbd1e0, 0xaa, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/additional_sketch_files_copier.go:83 +0x29 fp=0x12da1c0c sp=0x12da1bec pc=0x55f929
github.com/arduino/arduino-builder.(*AdditionalSketchFilesCopier).Run(0xb23924, 0x12bca200, 0xb23924, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/additional_sketch_files_copier.go:71 +0x1e1 fp=0x12da1c7c sp=0x12da1c0c pc=0x55f7f1
github.com/arduino/arduino-builder.(*ContainerMergeCopySketchFiles).Run(0xb23924, 0x12bca200, 0xb23924, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/container_merge_copy_sketch_files.go:48 +0xed fp=0x12da1cc0 sp=0x12da1c7c pc=0x56433d
github.com/arduino/arduino-builder.runCommands(0x12bca200, 0x12da1de8, 0x22, 0x22, 0x1, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:207 +0xc1 fp=0x12da1ce8 sp=0x12da1cc0 pc=0x560ec1
github.com/arduino/arduino-builder.(*Builder).Run(0x12b61f0c, 0x12bca200, 0x2d, 0x12b621e0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:125 +0xb3a fp=0x12da1efc sp=0x12da1ce8 pc=0x5604ca
github.com/arduino/arduino-builder.RunBuilder(0x12bca200, 0x2d, 0x12b621e0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:223 +0x29 fp=0x12da1f10 sp=0x12da1efc pc=0x5611b9
main.main()
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/arduino-builder/main.go:396 +0x72f fp=0x12da1fc8 sp=0x12da1f10 pc=0x79bd6f
runtime.main()
/home/jenkins/go1.10.2-patched/src/runtime/proc.go:198 +0x1ea fp=0x12da1ff0 sp=0x12da1fc8 pc=0x42a0ba
runtime.goexit()
/home/jenkins/go1.10.2-patched/src/runtime/asm_386.s:1665 +0x1 fp=0x12da1ff4 sp=0x12da1ff0 pc=0x451221
C:\Program Files (x86)\Arduino\arduino-builder returned 2
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"

The code was full of includes made by ST Micro.

Does the error only occur when attempting to compile this particular sketch, or does it also occur with a simple sketch like File > New?

With a new sheet i can compile. This error message comes only with one code.