On Apr 9, 2008, at 12:12, "João Rodrigues" <[EMAIL PROTECTED]> wrote:
I think your approach is flawed in several ways.
maxheap is just specifying an upper memory limit, the VM is not
going to attempt to allocate or reserve that much memory until it's
actually
needed.
Instead, you could try to use the initialheap keyword with initVM()
but that doesn't work as expected either. If the VM cannot reserve
that much memory it doesn't exit gracefully. It sends a signal
instead, killing the process. If you experiment with this be sure to
_also_ set a maxheap value that is larger than the initialheap,
otherwise you're going to get a different error from the VM, also
signalled by a crash.
>> I didn't mean maxheap, it was a typo :) initialheap was what I
meant.
It seems to me that when any error occurs at VM start up time that
has to do with errors in the arguments passed to it, it doesn't fail
to start gracefully with an error that Python can report. It simply
kills the process with a signal. I tried to set signal handlers for
Python to handle the signal but it looks like the signal sent by the
VM is one of the signals that can't be hooked (SIGKILL). I don't
know how this behaves on Windows either.
>> Gracefully is exactly not a word I'd use :) It currently gives an
error that doesn't shut down the script, and I have to "sudo kill"
it manually.. but that's probably because I'm messing with
lucene.JavaErrors, trys and excepts, in a ... messy way :)
I also tried to see if there was a way to tell Java not to signal at
all. Following this in gdb, it seems that it's using a function
called JVM_RaiseSignal() to do its thing but I could not find any
documentation about it nor is it declared in the <jni.h> header file.
>> Thanks for the effort :)
A better approach to your problem might be to check via Python -
before starting the VM - what kind of memory your system has and
'assume' that if enough is reported, the VM will be able to use it
if you give it to it via the initialheap and maxheap keywords.
>> I'll try to do it this way. I was avoiding it 'cause I didn't
want to use any additional libraries and I'm not sure how to do it
yet, but I'll search.
----
By the way, the problem I was having with the initialheap / maxheap,
it's "windows" specific.. I can run my script in the same machine,
in the Ubuntu 8.04 boot. I suppose it's a windows' specific
problem.. Is there a setting for "max memory usable by a VM?" in
windows?
Yes, it's maxheap and it's not Windows specific.
Also, I tried to compile my scripts to an exe file, so that it's
easier to use (no python needed..). I found some troubles with the
jvm.dll but managed to copy it to the directory of the compilation
and it worked pretty well :) And quite small as well.
And, to finish, I'd like to know how can I cite PyLucene in a
Bibliography of a scientific article. It's pretty much the
"software" core of my application so, you do deserve a credit :D
The credit goes to Lucene before going to PyLucene which just wraps it.
You're welcome to credit either whichever way you like.
Andi..
Best Regards!
João Rodrigues
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev