all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Menus and w32 memory management
@ 2014-06-02 14:21 Dmitry Antipov
  2014-06-02 16:07 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2014-06-02 14:21 UTC (permalink / raw)
  To: Emacs development discussions; +Cc: Eli Zaretskii

Looking through src/w32gui.h, I found the following fragment:

/* Local memory management for menus.  */
#define local_heap (GetProcessHeap ())
#define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
#define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))

#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
#define free_widget_value(wv) (local_free ((wv)))

Why we can't use generic xzalloc and xfree here?

Dmitry



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Menus and w32 memory management
  2014-06-02 14:21 Menus and w32 memory management Dmitry Antipov
@ 2014-06-02 16:07 ` Eli Zaretskii
  2014-06-02 18:54   ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2014-06-02 16:07 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> Date: Mon, 02 Jun 2014 18:21:26 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: Eli Zaretskii <eliz@gnu.org>
> 
> Looking through src/w32gui.h, I found the following fragment:
> 
> /* Local memory management for menus.  */
> #define local_heap (GetProcessHeap ())
> #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
> #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))
> 
> #define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
> #define free_widget_value(wv) (local_free ((wv)))

This code is very old.  We've been using separate allocation APIs
there since almost day one.  I have no idea why (and know very little
about it anyway).

> Why we can't use generic xzalloc and xfree here?

I guess (on the trunk, malloc is redirected to call HeapAlloc anyway),
except that they block input, something the code which calls these
local_* macros already does.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Menus and w32 memory management
  2014-06-02 16:07 ` Eli Zaretskii
@ 2014-06-02 18:54   ` Lennart Borgman
  2014-06-02 19:02     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2014-06-02 18:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Antipov, Emacs-Devel devel

On Mon, Jun 2, 2014 at 6:07 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 02 Jun 2014 18:21:26 +0400
>> From: Dmitry Antipov <dmantipov@yandex.ru>
>> CC: Eli Zaretskii <eliz@gnu.org>
>>
>> Looking through src/w32gui.h, I found the following fragment:
>>
>> /* Local memory management for menus.  */
>> #define local_heap (GetProcessHeap ())
>> #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
>> #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))
>>
>> #define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
>> #define free_widget_value(wv) (local_free ((wv)))
>
> This code is very old.  We've been using separate allocation APIs
> there since almost day one.  I have no idea why (and know very little
> about it anyway).

FYI. In my a couple of years old (patched) version of Emacs I have
constandly seen small memory corruptions in the menus since I moved to
64-bit MS Windows 7. I have no idea about the reason. I did not see
those problems on 32-bit Windows. The executable is 32-bit (since I
did not had time to look into recompiling with 64-bit tools then, too
much problems).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Menus and w32 memory management
  2014-06-02 18:54   ` Lennart Borgman
@ 2014-06-02 19:02     ` Eli Zaretskii
  2014-06-02 19:40       ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2014-06-02 19:02 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: dmantipov, emacs-devel

> From: Lennart Borgman <lennart.borgman@gmail.com>
> Date: Mon, 2 Jun 2014 20:54:10 +0200
> Cc: Dmitry Antipov <dmantipov@yandex.ru>, Emacs-Devel devel <emacs-devel@gnu.org>
> 
> FYI. In my a couple of years old (patched) version of Emacs I have
> constandly seen small memory corruptions in the menus since I moved to
> 64-bit MS Windows 7.

How do these corruptions look like?

There was a problem with menus on Windows whereby non-ASCII characters
would be displayed as '?'.  If this is what you see, that problem is
already solved.  If you see something else, a picture would help
(please, as a separate bug report, not here).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Menus and w32 memory management
  2014-06-02 19:02     ` Eli Zaretskii
@ 2014-06-02 19:40       ` Lennart Borgman
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2014-06-02 19:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Antipov, Emacs-Devel devel

On Mon, Jun 2, 2014 at 9:02 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Lennart Borgman <lennart.borgman@gmail.com>
>> Date: Mon, 2 Jun 2014 20:54:10 +0200
>> Cc: Dmitry Antipov <dmantipov@yandex.ru>, Emacs-Devel devel <emacs-devel@gnu.org>
>>
>> FYI. In my a couple of years old (patched) version of Emacs I have
>> constandly seen small memory corruptions in the menus since I moved to
>> 64-bit MS Windows 7.
>
> How do these corruptions look like?
>
> There was a problem with menus on Windows whereby non-ASCII characters
> would be displayed as '?'.  If this is what you see, that problem is
> already solved.  If you see something else, a picture would help
> (please, as a separate bug report, not here).

I just wanted to mention it now in case it could be to some help. When
I find time I will try to recompile with 64-bit tools (with my current
code) and see if that helps. It it does not I will file a bug report.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-02 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 14:21 Menus and w32 memory management Dmitry Antipov
2014-06-02 16:07 ` Eli Zaretskii
2014-06-02 18:54   ` Lennart Borgman
2014-06-02 19:02     ` Eli Zaretskii
2014-06-02 19:40       ` Lennart Borgman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.