Out of memory trying to allocate 750KB

Running on a G400 based system, GC shows there is 6.3MB of memory free and yet the allocation in the SMTP sender of 756,176 bytes fails with an out of memory exception.

Any idea why this would be the case?

Simple heap has a max of ~749kb

Large heap fella :wink:

@ Justin - what is a large heap? (vs simple heap)

Dave can you post the whole error message? I have seen some out of memory exceptions that were misleading as the issue was with periodic events stacking up and overrunning a fixed buffer. It was a timer object in my case but I bet there are other cases where something like that can happen.

The code break pointed at the allocation of the char array so I know it was this that caused the issue.

Justin’s post gave me the information I need and I think cyberh0me’s link might allow me to re-work the code to use this solution.

Not so easy it seems as the SMTP library uses a STRING to send the data to the SMTP server. Looks like a bit more work is needed here.

The encoding to BASE64 works using the LargeBuffer but parsing this to a String is taking hours. I kid you not. It will probably hit the 750K limit again anyway.

No time just now to sort out a rewrite of the library to keep the LargeBuffer intact and simply send this to the SMTP server so I will limit the data log files to 250KB for the time being. No bit deal as most times the log will be under 200KB.

Yeah, that is what I plan to do with the library. Looks like it should be fairly easy to get this working but no time for now to get it out with this release. Luckily we can remotely update the software :slight_smile: