new Class() always returning NULL

Hi i have a sketch like this:

  auto ptr = new Command::ServiceChain("test");
  if (ptr == NULL) beep_fail_fatal(); // <== always returning NULL => beep error

why the constructor returning NULL reference?
i’m using attiny 85.
everything works fine, except the new Class() operator.

What is your SRAM usage? The new operator returns zero, if it can not allocate enough memory.

why no exception occured?

yes the memory getting low:

Sketch uses 6104 bytes (74%) of program storage space. Maximum is 8192 bytes.
Global variables use 387 bytes (75%) of dynamic memory, leaving 125 bytes for local variables. Maximum is 512 bytes.
Low memory available, stability problems may occur.

any idea of reducing memory usage?

there are 4 global variable:

Bluetooth bt(/*rxPin*/BT_RX_PIN, /*txPin*/BT_TX_PIN, /*rsPin*/BT_RS_PIN);
Command cmd;
static bool sdebugOK = false;
static void* _this_ = NULL;

each weight 98, 5, 1, 1 bytes.

and there are a lot of function, some lambda function in my sketch.

why no exception occured?

How would you handle an exception?

Should we just ignore this

"Low memory available, stability problems may occur."

and take guesses at what the constructor does?

AWOL:
How would you handle an exception?

In c# just simple: add try{} catch(){} block.
In c++ should be the same.
The Arduino IDE is bit different than c++ visual studio.

BTW the problem solved.
I googled and found that Arduino hates a lot of strings.

My code surrounded by tons of string for debugging purpose.

After I shortening the strings, memory usage drop significantly.

Exceptions are just that; they should not occur. From memory, in C# catching an exception is significantly slower than testing (e.g. when converting text to int). But in C#, optimising for speed is a waste of time so it's not a train smash.

You can use the F() macro to move fixed text to program memory; that will reduce the buirden on RAM.

YunuZ:
In c# just simple: add try{} catch(){} block.
In c++ should be the same.
The Arduino IDE is bit different than c++ visual studio.

The IDE has nothing at all to do with this.

AVR-G++ does not support exceptions.
Handling exceptions essentially requires an operating system or at least a "significant" run time environment, and an AVR typically has neither.