-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alloc.c(177) : max_string_size reached #1307
Comments
This is driving me a bit crazy! Are there any plans for a fix? Or any work arounds? I am maintaining a legacy Flash/AIR project, and it just started producing this error after adding a few updated assets. |
Can you give us your stack trace? Nearly all of the line numbers have changed since mynameGY's post. If I'm not mistaken, it will point to Assuming it does point to those lines, the problem appears to be that Neko allocates a string in order to compress data, and has a maximum string length. Unfortunately, Neko is no longer being maintained, so I don't think a bug report would work. Maybe this could be fixed if Lime's tools ran in HashLink or something, but it that's only built for Neko at the moment and can't easily switch. You could disable asset compression, but that would hurt the end user experience. The Deflate algorithm breaks its data into blocks, so it might be possible to compress only a bit at a time, but I have no idea how. The most practical solution I can think of is to outsource the compression. For instance, 7-zip should be able to handle any amount of data. if( compressed )
{
var sevenZip = new haxe.Process("7za", ["a", "dummy.gz", "-si", "-so"]);
sevenZip.stdin.writeBytes(bytes, 0, bytes.length);
sevenZip.stdin.flush();
sevenZip.stdin.close();
var exitCode = sevenZip.exitCode();
if( exitCode != 0 )
throw '7-zip exited with code $exitCode';
bytes = sevenZip.stdout.readAll();
sevenZip.close();
} Insert that code in Writer.hx, run Disclaimer: this code is untested. |
Thanks! I will try that out ASAP. Here is my stack:
Note that I am actually targeting AIR. After a discussion on Discord, and a few tests, I have found that the error seems to occur when my assets folder goes over 256MB in size. Seems like it is related to this? HaxeFoundation/neko#189 |
Oh, interesting, for you it's happening a little earlier, during
It isn't going to work in your case. According to your stack trace, it's crashing before it even reaches the
Looks like the same issue, yeah. And they're right about switching to HashLink, but that'll take a while. Lime's tools have only ever been tested in Neko, and will probably break in all kinds of subtle ways anywhere else. |
It might still be a good idea to address this in the swf writer in format. There should be no need to allocate memory for the entire swf file at once, since it's possible for the swf's bytes to be deflated and written to the disk in chunks. This would require working out the uncompressed size of the file in advance, to complete the header information. Here is some example code from the haxe codebase which does this: https://github.com/HaxeFoundation/haxe/blob/731dcd71f10c495a5a820449249fbb3d4b40a7c1/libs/swflib/swfParser.ml#L2062-L2066. It can then use the haxe.zip.Compress.execute function to compress in parts, instead of .run which does everything at once. Using the (default) |
That sounds like it could work, though I doubt it'll be high priority. Since you seem more familiar with the details than I am, do you want to submit the issue? |
Makes sense. I've opened the issue anyway: HaxeFoundation/format#107 |
I have runned command "lime build flash", but it crashed with error:
Called from ? line 1
Called from CommandLineTools.hx line 1400
Called from CommandLineTools.hx line 25
Called from CommandLineTools.hx line 126
Called from CommandLineTools.hx line 619
Called from lime/project/PlatformTarget.hx line 70
Called from lime/tools/platforms/FlashPlatform.hx line 260
Called from lime/tools/helpers/FlashHelper.hx line 872
Called from lime/tools/helpers/FlashHelper.hx line 685
Called from format/swf/Writer.hx line 60
Called from format/swf/Writer.hx line 1425
Called from format/tools/Deflate.hx line 33
Called from /usr/lib/haxe/std/neko/_std/haxe/zip/Compress.hx line 48
Called from /usr/lib/haxe/std/haxe/io/Bytes.hx line 457
Uncaught exception - alloc.c(177) : max_string_size reached
When I delete some of the resources under my assets, I can build again successfully.
Thank's!
The text was updated successfully, but these errors were encountered: