Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Emacs and nxml/nxhtml-mode: memory overflow

154 views
Skip to first unread message

Martin Butz

unread,
Aug 23, 2012, 8:56:26 AM8/23/12
to Help-gn...@gnu.org
Hi,

since a few weeks I have some serious problem, while using emacs for
webdevelopement. I use (and would like to in future) nxhtml-mode. It
seems that this mode (or the underlying nxml-mode) causes emacs to
consume 100 % cpu-power - at least after a while. I can not spotify the
exact reason for this; in some cases it seem to be caused be validation.
Emacs says MEM FULL! (mode line), freezes and there's no other way as to
kill the process.

I setup a separate .emacs-webdev to use emacs for webdevelopement
without allmost any of my extensions/configuration, which I usually use.
This did work for a while, but as I had a crash today, it seems, that it
can happen anytime.

There might be some side effects concerning one or the other extension
but I have no clue how I can find out whats going on. It could also be
caused by some bug in nxhml/nxhtml-mode but I can not find any
information on the web, which seems to backup this.

I already filed a bug report at launchpad (which admittedly is based on
a very poor information base, as I do not know how to securely reproduce
the misbehaviour); also my posting at stackoverflow [2] was not crowned
with success.

Currently I use emacs 23.2.1 on Linux Mint 11. The last version of
nxml-mode I used is 20041004.

Any tips about that? How can I possibly find out, what emacs causes to
do that?

Greetings
Martin

[1] <https://bugs.launchpad.net/nxhtml/+bug/1032564>
[2]
<http://stackoverflow.com/questions/11247666/emacs-nxhtml-mode-memory-full>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| G. Martin Butz, m...@mkblog.org, 0421 98749324, www.mkblog.org |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dmitry Gutov

unread,
Aug 26, 2012, 10:35:41 AM8/26/12
to m...@mkblog.org, Help-gn...@gnu.org
Hi Martin,

Martin Butz <m...@mkblog.org> writes:
> since a few weeks I have some serious problem, while using emacs for
> webdevelopement. I use (and would like to in future) nxhtml-mode. It
seems that
> this mode (or the underlying nxml-mode) causes emacs to consume 100 %
cpu-power
> - at least after a while. I can not spotify the exact reason for
this; in some
> cases it seem to be caused be validation. Emacs says MEM FULL! (mode
line),
> freezes and there's no other way as to kill the process.
> ...

I can't help you with nxhtml-mode, but if you describe what exact
features from it you're using, people here might suggest some
alternatives.
nxml-mode, by the way, is considered fairly stable, so if you don't need
anything additional, you can use it alone.

--Dmitry

Jambunathan K

unread,
Aug 26, 2012, 12:01:51 PM8/26/12
to m...@mkblog.org, Help-gn...@gnu.org
Dmitry Gutov <dgu...@yandex.ru> writes:

>> since a few weeks I have some serious problem, while using emacs for
>> webdevelopement. I use (and would like to in future) nxhtml-mode. It
> seems that
>> this mode (or the underlying nxml-mode) causes emacs to consume 100
>> %
> cpu-power
>> - at least after a while. I can not spotify the exact reason for
> this; in some
>> cases it seem to be caused be validation. Emacs says MEM FULL! (mode
> line),
>> freezes and there's no other way as to kill the process.
>> ...

Have you tried disabling validation.

If your XML file has no newlines then Emacs will choke.

IIRC, validation happens under the control of timer. Try increasing it.
--

Martin Butz

unread,
Aug 26, 2012, 3:02:54 PM8/26/12
to Help-gn...@gnu.org
Am 26.08.2012 16:35, schrieb Dmitry Gutov:
> Hi Martin,

[...]

> I can't help you with nxhtml-mode, but if you describe what exact
> features from it you're using, people here might suggest some
> alternatives.

Mostly I am working with xhtml mixed with php, and css-mode. I found
that the indentation is the best of all modes, especially when working
with xhtml with php chunks. I offen use the option to find/mark matching
elements.

> nxml-mode, by the way, is considered fairly stable, so if you don't need
> anything additional, you can use it alone.

well yes, that's what I did. It seemed to work, although I started to
add some modes/extensions I offen use, such as anything and elscreen as
well as the stuff lots of people have in their dot-emacs (matching
parentheses aso.). At some point I again had this strange memory
overflow. I admit, I haven't had the patience to find out, whether it is
nxhtml crashes itself at some point or this is a side effect of nxhtml
and some other mode. As I said, I am not able to reprocuce it
consistantly. I only have the assumption, that it takes some time until
the crash occurs.

Thanks a lot for the input.

Martin

Martin Butz

unread,
Aug 26, 2012, 3:07:07 PM8/26/12
to Help-gn...@gnu.org
Am 26.08.2012 18:01, schrieb Jambunathan K:
> >> since a few weeks I have some serious problem, while using emacs for
>>> webdevelopement. I use (and would like to in future) nxhtml-mode. It
>> seems that
>>> this mode (or the underlying nxml-mode) causes emacs to consume 100
>>> %
>> cpu-power
>>> - at least after a while. I can not spotify the exact reason for
>> this; in some
>>> cases it seem to be caused be validation. Emacs says MEM FULL! (mode
>> line),
>>> freezes and there's no other way as to kill the process.
>>> ...
>
> Have you tried disabling validation.

I tried to do that over the menu, but did not find the responsible
variable to disable it completely.

> If your XML file has no newlines then Emacs will choke.

This is to say: at the EOF?

> IIRC, validation happens under the control of timer. Try increasing it.

Do you know, how to do this? I assume, it is a variable of nxml-mode, right?

Thanks

Jambunathan K

unread,
Aug 26, 2012, 3:18:07 PM8/26/12
to m...@mkblog.org, Help-gn...@gnu.org
Martin Butz <m...@mkblog.org> writes:

> Am 26.08.2012 18:01, schrieb Jambunathan K:
>> >> since a few weeks I have some serious problem, while using emacs for
>>>> webdevelopement. I use (and would like to in future) nxhtml-mode. It
>>> seems that
>>>> this mode (or the underlying nxml-mode) causes emacs to consume 100
>>>> %
>>> cpu-power
>>>> - at least after a while. I can not spotify the exact reason for
>>> this; in some
>>>> cases it seem to be caused be validation. Emacs says MEM FULL! (mode
>>> line),
>>>> freezes and there's no other way as to kill the process.
>>>> ...
>>
>> Have you tried disabling validation.
>
> I tried to do that over the menu, but did not find the responsible
> variable to disable it completely.

M-x apropos-variable RET validate RET

,----
| Type RET on an entry to view its full documentation.
|
| rng-nxml-auto-validate-flag
| Non-nil means automatically turn on validation with nxml-mode.
| rng-validate-chunk-size
| Number of characters in a RELAX NG validation chunk.
| rng-validate-delay
| Time in seconds that Emacs must be idle before starting a full
| validation.
| rng-validate-quick-delay
| Time in seconds that Emacs must be idle before starting a quick
| validation.
`----

>> If your XML file has no newlines then Emacs will choke.
>
> This is to say: at the EOF?

I mean long lines - something like this

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

instead of like this

aaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa

>> IIRC, validation happens under the control of timer. Try increasing it.
>
> Do you know, how to do this? I assume, it is a variable of nxml-mode, right?

See above options.

ps: I haven't used nxhtml-mode

> Thanks
> Martin

--

Dmitry Gutov

unread,
Aug 26, 2012, 4:19:43 PM8/26/12
to m...@mkblog.org, Help-gn...@gnu.org
Martin Butz <m...@mkblog.org> writes:
> Am 26.08.2012 18:01, schrieb Jambunathan K:
>> Have you tried disabling validation.
>
> I tried to do that over the menu, but did not find the responsible
variable to
> disable it completely.

If you're going to disable validation, you might want to look into just
using html-mode instead of nxml-mode. It has commands for moving to
matching tags, too:

http://stackoverflow.com/questions/7022556/emacs-nxhtml-how-to-highlight-or-jump-to-the-closing-html-tag

IIRC nxhtml should also have a multi-mode for PHP that is based on
html-mode.

Richard Riley

unread,
Aug 27, 2012, 5:37:25 AM8/27/12
to help-gn...@gnu.org
Jambunathan K <kjambu...@gmail.com> writes:

> Martin Butz <m...@mkblog.org> writes:
>
>> Am 26.08.2012 18:01, schrieb Jambunathan K:
>>> >> since a few weeks I have some serious problem, while using emacs for
>>>>> webdevelopement. I use (and would like to in future) nxhtml-mode. It
>>>> seems that
>>>>> this mode (or the underlying nxml-mode) causes emacs to consume 100
>>>>> %
>>>> cpu-power
>>>>> - at least after a while. I can not spotify the exact reason for
>>>> this; in some
>>>>> cases it seem to be caused be validation. Emacs says MEM FULL! (mode
>>>> line),
>>>>> freezes and there's no other way as to kill the process.
>>>>> ...
>>>
>>> Have you tried disabling validation.
>>
>> I tried to do that over the menu, but did not find the responsible
>> variable to disable it completely.
>
I've tried most methods for mixed mode.

nxhtml is really the only mode for mixed mode programming that even
begins to be useful. I tend to find most other recommendations are done
by people who are not using mixed mode at all. Regradless how the
purists see mixed mode files (try mentioning PHP even in #emacs) , they
are very common. php and html/css/javascript in one file is not
unusual. Emacs addressing this "natively" would be a real boon.

Unfortunately nxhrml doesnt seem to be maintained anymore, or?
Certainly in trunk emacs 24 using nxthml produces loads of popup error
buffers. I emailed the author but got no response.


Richard Riley

unread,
Aug 27, 2012, 5:38:53 AM8/27/12
to help-gn...@gnu.org
Dmitry Gutov <dgu...@yandex.ru> writes:

> Martin Butz <m...@mkblog.org> writes:
>> Am 26.08.2012 18:01, schrieb Jambunathan K:
>>> Have you tried disabling validation.
>>
>> I tried to do that over the menu, but did not find the responsible
> variable to
>> disable it completely.
>
> If you're going to disable validation, you might want to look into just
> using html-mode instead of nxml-mode. It has commands for moving to
> matching tags, too:

html-mode is useless, give or take, for mixed mode files.

>
> http://stackoverflow.com/questions/7022556/emacs-nxhtml-how-to-highlight-or-jump-to-the-closing-html-tag
>
> IIRC nxhtml should also have a multi-mode for PHP that is based on
> html-mode.

nxhtml ships with its own php mode and is one of the main reasons for
its development from what I can gather. It has come along a long way and
is very useful when it works properly.


Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org
Hi Jambinathan,

Am 26.08.2012 21:18, schrieb Jambunathan K:
> M-x apropos-variable RET validate RET
>
> ,----
> | Type RET on an entry to view its full documentation.
> |
> | rng-nxml-auto-validate-flag
> | Non-nil means automatically turn on validation with nxml-mode.
> | rng-validate-chunk-size
> | Number of characters in a RELAX NG validation chunk.
> | rng-validate-delay
> | Time in seconds that Emacs must be idle before starting a full
> | validation.
> | rng-validate-quick-delay
> | Time in seconds that Emacs must be idle before starting a quick
> | validation.
> `----

Thanks. I'll give it a try.

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Martin Butz

unread,
Aug 27, 2012, 2:44:33 PM8/27/12
to Help-gn...@gnu.org

Dmitry Gutov

unread,
Aug 27, 2012, 2:55:16 PM8/27/12
to Richard Riley, help-gn...@gnu.org
Richard Riley <ril...@gmail.com> writes:
> I've tried most methods for mixed mode.
>
> nxhtml is really the only mode for mixed mode programming that even
> begins to be useful. I tend to find most other recommendations are done
> by people who are not using mixed mode at all. Regradless how the
> purists see mixed mode files (try mentioning PHP even in #emacs) , they
> are very common. php and html/css/javascript in one file is not
> unusual. Emacs addressing this "natively" would be a real boon.
>
> Unfortunately nxhrml doesnt seem to be maintained anymore, or?
> Certainly in trunk emacs 24 using nxthml produces loads of popup error
> buffers. I emailed the author but got no response.

If you were using ERB (with Rails) or EJS, I'd have another suggestion,
but for PHP you can try web-mode [1] that was announced on one of the
mailing lists here a few weeks ago.
I've no idea about its quality, but at least it's still being developed.

[1] http://web-mode.org/

--Dmitry

Martin Butz

unread,
Aug 27, 2012, 4:11:54 PM8/27/12
to Help-gn...@gnu.org
I am sorry. The mailserver I am using seems to have a hickup....

Martin
0 new messages