[Barrelfish-users] Memorry allocation weirdness
yorgos at kth.se
Wed Dec 7 00:31:08 CET 2011
What guarantees does barrelfish provide for memory allocated by applications? Does the kernel clean up the memory when the application terminates? If yes does that extend to all of its domain? And what kind of consistency checks does malloc() provide? Is the allocated memory fragmented?
I'm only asking because of some very weird behavior I witness. Let me give the most recent example:
I have a server client design. I'm also interested for the server to handle multiple instances of applications simultaneously or not.
Let's assume server S on core 0. After it starts I execute client application A1 on core 0 and I wait for it to finish. S of course allocates memory to keep the status of A1. After A1 terminates it signals S which cleans up that memory, aka it calls free() on the related structures.
Everything looks fine to this point.
Then I start a new instance of the same application, lets call it A2.
A2 will crash with a page fault. If I do not free the memory that S allocates, A2 will NOT crash.
A2 will not crash if I span it to more cores and/or if I start it on a different core.
I have checked my code character by character and I cannot understand how freeing memory on the Server can cause the client to crash. Especially since the client executes after the free() command on S has finished. My only guess is that I assume free() to work in a very different way than it does.
Please shed some light to all of this...
More information about the Barrelfish-users