Virtual memory leak?
Posted: Wed Nov 25, 2015 3:09 pm
Hello,
I've been having some problems when I try to do multiple calls to "e_load_group". About the 94th or 96th time I call it I get:
e_alloc(): mmap failure.
ERROR: Can't allocate external memory buffer!
Finally I decided to investigate the problem, as it is now critical for the code I am developing. I ran "top" on a 2nd ssh console, and found that the problem seemed to be Virtual Memory. Physical free memory remains ok, but virtual memory used rises like crazy.
When it gets to 3071964 KB the program crashes and show the message above.
Searching on the web I found that many linux kernels give a limit of 3GB Virtual Memory to any process. That would be 3145728, which looks suspiciously consistent with the problem.
Anyway (it's not what this linux says, but who knows... hidden limits...?):
>>ulimit -v
> unlimited
In any case, every call to e_load_group increases (a lot) the amount of virtual memory in use. I made a new program that doesn't use e_load at all (it has some e_alloc though, and other esdk init functions). With that change virtual memory still increases, but now much less and, for the tests I have run, to acceptable boundaries (it still increases, so if I left my program running some time (minutes/hours) it may crash... so: still not good).
I am not an expert in C (or linux) memory management. Is there any way to free that memory?
I will write some simple (a "repeated Hello World") code to expose the problem and try to fix it, if possible, but any ideas are welcome (maybe I am doing something wrong, also).
I've been having some problems when I try to do multiple calls to "e_load_group". About the 94th or 96th time I call it I get:
e_alloc(): mmap failure.
ERROR: Can't allocate external memory buffer!
Finally I decided to investigate the problem, as it is now critical for the code I am developing. I ran "top" on a 2nd ssh console, and found that the problem seemed to be Virtual Memory. Physical free memory remains ok, but virtual memory used rises like crazy.
When it gets to 3071964 KB the program crashes and show the message above.
Searching on the web I found that many linux kernels give a limit of 3GB Virtual Memory to any process. That would be 3145728, which looks suspiciously consistent with the problem.
Anyway (it's not what this linux says, but who knows... hidden limits...?):
>>ulimit -v
> unlimited
In any case, every call to e_load_group increases (a lot) the amount of virtual memory in use. I made a new program that doesn't use e_load at all (it has some e_alloc though, and other esdk init functions). With that change virtual memory still increases, but now much less and, for the tests I have run, to acceptable boundaries (it still increases, so if I left my program running some time (minutes/hours) it may crash... so: still not good).
I am not an expert in C (or linux) memory management. Is there any way to free that memory?
I will write some simple (a "repeated Hello World") code to expose the problem and try to fix it, if possible, but any ideas are welcome (maybe I am doing something wrong, also).