Page 1 of 1
Qemu is allocating too much memory
Posted: Fri Dec 20, 2013 1:41 pm
by Isaac
Hi,
I have a kernel (it's approximately 236 bytes). When I try it with qemu, like this:
Code: Select all
qemu-system-i386 -kernel kernel.bin
I get this error:
Code: Select all
(process:4369): GLib-ERROR **: /build/buildd/glib2.0-2.38.1/./glib/gmem.c:110: failed to allocate 18446744073709549292 bytes
Trace/breakpoint trap (core dumped)
My kernel does not need that much memory. So why is qemu trying to allocate it?
Re: Qemu is allocating too much memory
Posted: Fri Dec 20, 2013 2:55 pm
by Brendan
Hi,
Isaac wrote:I get this error:
Code: Select all
(process:4369): GLib-ERROR **: /build/buildd/glib2.0-2.38.1/./glib/gmem.c:110: failed to allocate 18446744073709549292 bytes
Trace/breakpoint trap (core dumped)
My kernel does not need that much memory. So why is qemu trying to allocate it?
It's a lot more likely is that it's trying to allocate "-2324 bytes", and that there's a conversion from signed to unsigned involved.
Note: 18446744073709549292 = 0xFFFFFFFFFFFFF6EC = -2324.
Cheers,
Brendan
Re: Qemu is allocating too much memory
Posted: Fri Dec 20, 2013 4:15 pm
by bluemoon
Isaac wrote:Hi,
Code: Select all
qemu-system-i386 -kernel kernel.bin
-kernel assume a linux kind kernel, and probably require multi-boot compliant.
I seems that an 236 bytes image does not fit.
Re: Qemu is allocating too much memory
Posted: Sat Dec 21, 2013 10:13 pm
by Isaac
Brendan wrote:It's a lot more likely is that it's trying to allocate "-2324 bytes", and that there's a conversion from signed to unsigned involved.
I went through my code and changed every "int" and "char" to "unsigned int" and "unsigned char", it didn't help. I then tried going through my code again changing all those lines to "singed int" and " signed char", that didn't either help. So, is there anything that I can actually do about this?
PS. I did get a warning message when I changed those lines to "signed".
Re: Qemu is allocating too much memory
Posted: Sat Dec 21, 2013 10:42 pm
by Love4Boobies
bluemoon wrote:-kernel assume a linux kind kernel, and probably require multi-boot compliant.
That's self-contradictory, since Linux is not Multiboot-compliant. At any rate, -kernel requires either one or the other.
Isaac wrote:Brendan wrote:It's a lot more likely is that it's trying to allocate "-2324 bytes", and that there's a conversion from signed to unsigned involved.
I went through my code and changed every "int" and "char" to "unsigned int" and "unsigned char", it didn't help. I then tried going through my code again changing all those lines to "singed int" and " signed char", that didn't either help. So, is there anything that I can actually do about this?
PS. I did get a warning message when I changed those lines to "signed".
Oh, wow. I don't know what is sadder---that you aren't able to tell whether it's your OS or your emulator that is crashing or the "solution" you came up with.
At any rate, what version of QEMU is it, who built it, and can we have the kernel image in question? It might be worth reporting.