Torch::one give Segmentation fault in c++

This issue in the Python version may be reported on 10-Jul-2018 by InnovArul. But there is no issue in Python version in this case and gives Segmentation fault in C++.
I run this in Apple M1 with PyTorch version: 1.11.0. Could you suggest how to fix it?

// No issue 
torch::Tensor foo = torch::ones(30000); 

//  zsh: segmentation fault
torch::Tensor foo = torch::ones(36300); 

// No issue in pytorch 
import torch
foo = torch.ones(36300)

I find torch::ones(>36300) give “Segmentation fault” when link OpenCv_LIBS in CMakeList.txt.

# No issue case:  
target_link_libraries(example-app "${TORCH_LIBRARIES}" )      # In CMakeLists.txt 

torch::Tensor foo = torch::ones(36300);    


# zsh: segmentation fault case: 

target_link_libraries(example-app ${TORCH_LIBRARIES}  ${OpenCV_LIBS})     # In CMakeLists.txt 

torch::Tensor foo = torch::ones(36300);     #torch::ones(30000) is ok.  

 zsh: segmentation fault