R2024b Codegen runs out of memory. R2018a compiles to .mex and .C++ without issues.

I have cut down a code base to a single function that compiles to .mex and to .cpp just fine using R2018a. However, using R2024b (which I just got), the compiler runs a long time, but eventually runs out of memory and errors out.
I have looked at the coder.config('mex') and coder.config('lib') outputs for both versions, and I don't see anthing obvious.
I have attached the short test bench I used: RxTB.m, the .mat file it loads (OFDMRxSave.mat), and the problemmatic code, OFDMRxR1.m
Again, this compiles fine under R2018a, but fails using R2024b, with no changes to anything, including the .prj file. However, I cannot attach the .prj file, because the file type is not allowed by this APP.

5 Commenti

I will mention that the code compiles to .mex just fine using R2024b. It's only when compiling to C/C++ where the compiler runs away, uses all memory, then errors our.
Can you please attach the missing files, so that the issue can be reproduced?
I attempted to use the attached RxTaskTB as a testbench, but it references OFDMInit() which is absent.
Or maybe you can provide the codegen command line that you used to compile ODFMRxR1.m, or the project file (if you used the Coder UI)?
My apologies... I've attached OFDMInit() file.
I tried to attach the relevant .prj file, but that format is not accepted.
Best,
Kurt
And, by the way, R2024b compiles this code to .mex without any errors, so it's only when I try to compile to .C or .C++ that problems arise. Very strange.
What I get when I compile to .mex: No issues detected.

Accedi per commentare.

Risposte (1)

Subhajyoti
Subhajyoti il 22 Ott 2024
Modificato: Subhajyoti il 22 Ott 2024
It is my understanding that you are able to generate the MEX files for your code. But when you are trying to generate C/C++ files, it is throwing out of memory error.
This error is due to implicit expansion operation occurring during run-time.
Refer to following MathWorks Documentation link to know more about ‘Optimize Implicit Expansion in Generated Code’ in MATLAB:
While generating MEX file, the MATLAB Coder generates C or C++ files (as mentioned in code-generation parameter) and the MEX file acts like an API between MATLAB and the C/C++ file. You can also use these C/C++ files directly as a workaround for code-generation error. The C/C++ build files are generated in the following path:
./codegen/mex/OFDMRxR1/
Additionally, you can refer to the following resources to know more about Analysis and Generation of C/C++ Code from MATLAB Code Using "MATLAB Coder":

Categorie

Scopri di più su MATLAB Coder in Centro assistenza e File Exchange

Prodotti

Release

R2024b

Richiesto:

il 14 Ott 2024

Modificato:

il 22 Ott 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by