Source:
#include <stdlib.h>
extern "C"
{
void* JInit();
long JFree(void* js);
}
int main(void)
{
void *j;
for(int i=0; i<1000000; ++i)
{
j=JInit();
JFree(j);
}
return 0;
}
Build script:
g++ -s -O3 main.cpp -lj601
OS: linux, 2.6.x
GCC: 4.0.3
Time/mem_size log:
0 sec 300 MB
3 sec 900 MB
20 sec 1.1 GB
1 min 1.3 GB
2 min 1.5 GB
5 min crash
Yuri Burger wrote:
It seems that JFree does not freeing anything 8-\ I run a process
which
calls JInit, run several simple sentences and then calls JFree for
corresponding J session handle (pointer)... I found that this test has
a
problems with memory leaks.. :(
What is I am doing wrong?
One thing you're not doing is explaining how to reproduce your results,
and how a person could tell whether or not they have succeeded in
seeing the same results you are getting.
That said, I believe JFree returns memory to the J interpreter, which
is not the same thing as returning memory to the OS. If it's possible
to return memory to the OS, without exiting the program, it's probably
only possible in very large chunks (4MB pages, maybe?), and then only
under certain conditions. [The details will depend on which OS you
are using, and I don't know if or how any of the J interpreters
address these issues.]
--
Yuri Burger,
Senior Researcher
Kiev Zoral Development Center
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm