Skip to content
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

Out of memory #3

Open
strohhut opened this issue Apr 9, 2020 · 2 comments
Open

Out of memory #3

strohhut opened this issue Apr 9, 2020 · 2 comments

Comments

@strohhut
Copy link

strohhut commented Apr 9, 2020

I have 100 jpg files (85 MB in total) and when I want to convert them to a pdf via

merge2pdf.exe output.pdf "my path"

I get:

runtime: out of memory: cannot allocate 7274496-byte block (1320812544 in use)
fatal error: out of memory

runtime stack:
runtime.throw(0x7bade2, 0xd)
        /usr/local/go/src/runtime/panic.go:596 +0x7c
runtime.largeAlloc(0x6f0000, 0x446700, 0x51404000)
        /usr/local/go/src/runtime/malloc.go:797 +0xdb
runtime.mallocgc.func1()
        /usr/local/go/src/runtime/malloc.go:690 +0x31
runtime.systemstack(0x10ee2000)
        /usr/local/go/src/runtime/asm_386.s:337 +0x5e
runtime.mstart()
        /usr/local/go/src/runtime/proc.go:1132

goroutine 1 [running]:
runtime.systemstack_switch()
        /usr/local/go/src/runtime/asm_386.s:291 fp=0x11013ba8 sp=0x11013ba4
runtime.mallocgc(0x6f0000, 0x0, 0x1d0000, 0x51404000)
        /usr/local/go/src/runtime/malloc.go:691 +0x6c7 fp=0x11013bf8 sp=0x11013ba8
runtime.growslice(0x7659c0, 0x50e78000, 0x58bfff, 0x58c000, 0x58c002, 0x51404000, 0x1d0000, 0x244000)
        /usr/local/go/src/runtime/slice.go:140 +0x1c7 fp=0x11013c44 sp=0x11013bf8
github.com/unidoc/unidoc/pdf/model.DefaultImageHandler.NewImageFromGoImage(0x94b7a0, 0x6095e3c0, 0x94b7a0, 0x6095e3c0, 0x7b1b4f)
        /Users/ajaxray/go/src/github.com/unidoc/unidoc/pdf/model/image.go:247 +0x344 fp=0x11013d18 sp=0x11013c44
github.com/unidoc/unidoc/pdf/model.DefaultImageHandler.Read(0x948c40, 0x593fcf60, 0x20, 0x780760, 0x1)
        /Users/ajaxray/go/src/github.com/unidoc/unidoc/pdf/model/image.go:282 +0x10f fp=0x11013d4c sp=0x11013d18
github.com/unidoc/unidoc/pdf/model.(*DefaultImageHandler).Read(0x9854a0, 0x948c40, 0x593fcf60, 0x36f328c0, 0x0, 0x0)
        <autogenerated>:313 +0x46 fp=0x11013d68 sp=0x11013d4c
github.com/unidoc/unidoc/pdf/creator.NewImageFromData(0x4c794000, 0xcbab0, 0xcbcb0, 0xcbab0, 0xcbcb0, 0x0)
        /Users/ajaxray/go/src/github.com/unidoc/unidoc/pdf/creator/image.go:78 +0x88 fp=0x11013da0 sp=0x11013d68
github.com/unidoc/unidoc/pdf/creator.NewImageFromFile(0x1106c550, 0x46, 0x755940, 0x605f8f70, 0x10f02200)
        /Users/ajaxray/go/src/github.com/unidoc/unidoc/pdf/creator/image.go:94 +0x55 fp=0x11013dc0 sp=0x11013da0
main.createImage(0x1106c550, 0x46, 0x7b204d, 0x5, 0x7b6f91, 0xa, 0x1106c592, 0x4, 0x985624, 0x0, ...)
        /Users/ajaxray/go/src/github.com/ajaxray/merge2pdf/img.go:60 +0x181 fp=0x11013dfc sp=0x11013dc0
main.addImage(0x1106c550, 0x46, 0x7b204d, 0x5, 0x7b6f91, 0xa, 0x1106c592, 0x4, 0x985624, 0x0, ...)
        /Users/ajaxray/go/src/github.com/ajaxray/merge2pdf/img.go:31 +0x31 fp=0x11013e40 sp=0x11013dfc
main.ImgSource.MergeTo(0x1106c550, 0x46, 0x7b204d, 0x5, 0x7b6f91, 0xa, 0x1106c592, 0x4, 0x985624, 0x0, ...)
        /Users/ajaxray/go/src/github.com/ajaxray/merge2pdf/img.go:27 +0xa9 fp=0x11013e84 sp=0x11013e40
main.(*ImgSource).MergeTo(0x1104b2c0, 0x10f164e0, 0x0, 0x0)
        <autogenerated>:3 +0x46 fp=0x11013ec0 sp=0x11013e84
main.DirSource.MergeTo(0x10f08080, 0x30, 0x1101d000, 0x112, 0x200, 0x10f164e0, 0x10f164e0, 0x11001c00)
        /Users/ajaxray/go/src/github.com/ajaxray/merge2pdf/dir.go:21 +0xc5 fp=0x11013ef4 sp=0x11013ec0
main.(*DirSource).MergeTo(0x110152e0, 0x10f164e0, 0x949800, 0x110152e0)
        <autogenerated>:2 +0x46 fp=0x11013f18 sp=0x11013ef4
main.main()
        /Users/ajaxray/go/src/github.com/ajaxray/merge2pdf/main.go:63 +0xe7 fp=0x11013fc8 sp=0x11013f18
runtime.main()
        /usr/local/go/src/runtime/proc.go:185 +0x1d6 fp=0x11013ff0 sp=0x11013fc8
runtime.goexit()
        /usr/local/go/src/runtime/asm_386.s:1629 +0x1 fp=0x11013ff4 sp=0x11013ff0

I'm using Windows 10 and have more than 10 GB of unallocated RAM.

@rodneivetepessoal
Copy link

I Have same problem.

@ajaxray
Copy link
Owner

ajaxray commented Jul 3, 2021

Hi @strohhut ,
Thanks a lot for asking 👍🏼

Can you please run the command with adding -v flag and share the printed debug messages?

The first thing I want to check is - if the directory path is identified properly. If the given path is not correct anyway, there is a chance of starting to work on wrong directory. Which may have thousands of files and can eat up the whole memory.

Also, you may check if there is a memory limit for your process and can try to increase the limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants