Pragma msg goes out of memory when supplied with large data.

realhet real_het at hotmail.com
Wed May 21 14:00:56 UTC 2025


Hi,

I have a pragma(msg, xxx) statement where x is a byte array of 
30KBytes.

LDC2 produces the following symptom: It's memory usage goes 
slowly up to the maximum (20GB) then stops with out of memory 
error. The amount of used memory grows in an exponentially 
slowing rate. (I guess it's a reallocation/append problem, but I 
can't see what's going on inside. For small data it's ok, but for 
'big' data it's bad. But normally pragma(msg) is not used for 
'big' data.)

I can catch the contents on the other side of stdout stream.

But it violates something inside LDC2/DMD (win64 platform).

I also know it's not a normal scenario, but I have a reason to 
try hard and solve it.
(It's going to be a CompileTime build/make system for GLSL shader 
code embedded into a D environment.)

Anyone has more knowledge on this, please help me.  I tried to 
send a quoted string too, but also failed. Just like ubyte[]. All 
my experiments going in a direction that pragma(msg, xxx) has an 
upper limit for safe working. For a few kilobytes it was perfect. 
With a hello world compute shader it was perfect: the shader 
source received all the constants known in Compile Time and the 
generated exe file received the compiled shader binary using the 
new string import feature. But with a larger production shader, 
my smile went down fast :S

Now I will try a new crazy idea: multipart pragma messages. I 
hope it will cancel out that exponential growth problem I feel.


More information about the Digitalmars-d-learn mailing list