Qemu is allocating too much memory

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Isaac
Member
Member
Posts: 66
Joined: Sat Dec 07, 2013 7:08 pm

Qemu is allocating too much memory

Post 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?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Qemu is allocating too much memory

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Qemu is allocating too much memory

Post 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.
Isaac
Member
Member
Posts: 66
Joined: Sat Dec 07, 2013 7:08 pm

Re: Qemu is allocating too much memory

Post 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".
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Qemu is allocating too much memory

Post 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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Post Reply