Multi-line text input at Test Window has memory leak when we use ctrl-c, ctrl-v at the window #714

Closed
opened 2016-06-26 07:16:54 +00:00 by dodo1004 · 9 comments
dodo1004 commented 2016-06-26 07:16:54 +00:00 (Migrated from github.com)

Multi-line text input at Test Window has memory leak when we use ctrl-c, ctrl-v at the window

you can detect it you just copy the window text and past at the same text window.

Multi-line text input at Test Window has memory leak when we use ctrl-c, ctrl-v at the window you can detect it you just copy the window text and past at the same text window.
ocornut commented 2016-06-26 09:01:56 +00:00 (Migrated from github.com)

Are you talking about an actual leak or a growing buffer? Can you show samples of your detection?

On 26 Jun 2016, at 09:17, dodo1004 notifications@github.com wrote:

Multi-line text input at Test Window has memory leak when we use ctrl-c, ctrl-v at the window

you can detect it you just copy the window text and past at the same text window.

―
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Are you talking about an actual leak or a growing buffer? Can you show samples of your detection? > On 26 Jun 2016, at 09:17, dodo1004 notifications@github.com wrote: > > Multi-line text input at Test Window has memory leak when we use ctrl-c, ctrl-v at the window > > you can detect it you just copy the window text and past at the same text window. > > ― > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread.
dodo1004 commented 2016-06-26 10:59:34 +00:00 (Migrated from github.com)

I am now busy at a project so can not see it deeply.
but what I saw is that when I see a memory leak the Pasted memory is not freed

Detected memory leaks!
Dumping objects ->
{102535} normal block at 0x0F487ED0, 322 bytes long.
Data: </* The Pentium > 2F 2A 0A 20 54 68 65 20 50 65 6E 74 69 75 6D 20
Object dump complete.

and it is not a growing buffer.
I am using VS 2015 and memory leak check option is like this
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_1024_DF);

I am now busy at a project so can not see it deeply. but what I saw is that when I see a memory leak the Pasted memory is not freed Detected memory leaks! Dumping objects -> {102535} normal block at 0x0F487ED0, 322 bytes long. Data: </\* The Pentium > 2F 2A 0A 20 54 68 65 20 50 65 6E 74 69 75 6D 20 Object dump complete. and it is not a growing buffer. I am using VS 2015 and memory leak check option is like this _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_1024_DF);
ocornut commented 2016-06-26 11:03:03 +00:00 (Migrated from github.com)

I cannot seem to repro. Did you call ImGui::Shutdown() ?
All the memory held by the text edit state is carried in ImVector<> which has a destructor.

I cannot seem to repro. Did you call ImGui::Shutdown() ? All the memory held by the text edit state is carried in ImVector<> which has a destructor.
dodo1004 commented 2016-06-26 11:07:41 +00:00 (Migrated from github.com)

void ImGui_ImplDX11_Shutdown()
{
ImGui_ImplDX11_InvalidateDeviceObjects();
ImGui::Shutdown();
g_pd3dDevice = NULL;
g_pd3dDeviceContext = NULL;
g_hWnd = (HWND)0;
}

Detected memory leaks!
Dumping objects ->
{90594} normal block at 0x0F085100, 349 bytes long.
Data: <* The Pentium F> 2A 0A 20 54 68 65 20 50 65 6E 74 69 75 6D 20 46
Object dump complete.

yes i checked it again.

void ImGui_ImplDX11_Shutdown() { ImGui_ImplDX11_InvalidateDeviceObjects(); ImGui::Shutdown(); g_pd3dDevice = NULL; g_pd3dDeviceContext = NULL; g_hWnd = (HWND)0; } Detected memory leaks! Dumping objects -> {90594} normal block at 0x0F085100, 349 bytes long. Data: <\* The Pentium F> 2A 0A 20 54 68 65 20 50 65 6E 74 69 75 6D 20 46 Object dump complete. yes i checked it again.
dodo1004 commented 2016-06-26 11:08:57 +00:00 (Migrated from github.com)

and I will try to check it out too.

and I will try to check it out too.
ocornut commented 2016-06-26 11:11:07 +00:00 (Migrated from github.com)

Interesting/weird, I get it with the DX11 sample but not with the OpenGL one.

Interesting/weird, I get it with the DX11 sample but not with the OpenGL one.
ocornut commented 2016-06-26 11:15:35 +00:00 (Migrated from github.com)

Oh I see, it isn't InputTextMultiline(), but the default clipboard helper for Windows:

static const char* GetClipboardTextFn_DefaultImpl()
{
    static char* buf_local = NULL;
    if (buf_local)
    {
        ImGui::MemFree(buf_local);
        buf_local = NULL;
    }

There's a local buffer.

Oh I see, it isn't InputTextMultiline(), but the default clipboard helper for Windows: ``` static const char* GetClipboardTextFn_DefaultImpl() { static char* buf_local = NULL; if (buf_local) { ImGui::MemFree(buf_local); buf_local = NULL; } ``` There's a local buffer.
ocornut commented 2016-06-26 11:26:28 +00:00 (Migrated from github.com)

Fixed, thanks!
It was a one-time end of application leak so really not causing a problem in the long run, but obviously correct to fix.

Fixed, thanks! It was a one-time end of application leak so really not causing a problem in the long run, but obviously correct to fix.
dodo1004 commented 2016-06-26 11:53:00 +00:00 (Migrated from github.com)

Nice Job.

It is good to run now.

Nice Job. It is good to run now.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#714
No description provided.