View Single Post
Old 18 February 2021, 22:31   #12
edmayn
Registered User
 
Join Date: May 2017
Location: Silkeborg/Denmark
Posts: 22
I have diving into this the last couple of days, since after having added a simple window, with no IDCMP flags, to a program I am currently developing MemLog started reporting a memory leak, like this:

Code:
0x00000028 bytes at 0x07DDD4C8, Stack traceback:
	0x07930E70 0x078083E0 0x00000028 0x07930EB8 0x07EB9A82 0x07931CD8 0x07F1AE00 0x07811090
	0x07931CA2 0x078D1DB8 0x07930D5C 0x07F1B0F0 0x07811090 0x078D1DB8 0x07930DD2 0x00000000
	0x078D1DB8 0x07DEB1B8 0x01F7078D 0x1DB80000 0x078D1DB8 0x07DEB1B8 0x078D1DB8 0x07EB99A0
	0x07930A46 0x00000000 0x07E220B4 0x07DEB1B8 0x078083E0 0x07E6C8B0 0x07EB99B0 0x07930910
	0x0780A12C 0x078D1DB8 0x07EB99E0 0x07916162 0x01F7843B 0x00000000 0x07E220B4 0x0780A12C
	0x07EB9B10 0x07EB9A88 0x078083E0 0x00000000 0x07DEB1B8 0x078083E0 0x00FE6FD4 0x0780A12C
	0x00FD62AC 0x00000000 0x07DEB1B8 0x00FD53B0 0x07E220B4 0x07E220B4 0x0780A12C 0x00FD60E8
	0x07EB9B10 0x00FD69D2 0x0000000E 0x07E220B4 0x07EB9A4C 0x0780A12C 0x00FD5074 0x00FD4F94
0x00009BAF bytes required in total, 0x00000028 not yet released.
The window is closed with "CloseWindow()".

CodeWatcher reports something similar.

This simple piece of code, also triggers a warning:
Code:
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/dos.h>

int main(void)
{
	struct TagItem tagitem[8];
	struct Window *window;
	unsigned long ilock = LockIBase(0L);
	struct Screen *screen = LockPubScreen(NULL);

        tagitem[0].ti_Tag = WA_Width;
        tagitem[0].ti_Data = 500;
        tagitem[1].ti_Tag = WA_Height;
        tagitem[1].ti_Data = 300;
        tagitem[2].ti_Tag = WA_Top;
        tagitem[2].ti_Data = 400;
        tagitem[3].ti_Tag = WA_Left;
        tagitem[3].ti_Data = 300;
	tagitem[4].ti_Tag = WA_Borderless;
	tagitem[4].ti_Data = 1;
	tagitem[5].ti_Tag = WA_NoCareRefresh;
	tagitem[5].ti_Data = 1;
	tagitem[6].ti_Tag = WA_IDCMP;
	tagitem[6].ti_Data = 0;
	tagitem[7].ti_Tag = TAG_DONE;

        if (!(window = OpenWindowTagList(NULL, tagitem))) {
		UnlockPubScreen(NULL, screen);
		UnlockIBase(ilock);
		return 1;
	}

	UnlockPubScreen(NULL, screen);
	UnlockIBase(ilock);

	Delay(200);
        CloseWindow(window);
	
	return 0;
}
I also tried the above code with OpenLibrary/CloseLibrary with Intuition.library. NULLing the window->RastPort, reply to UserPort msgs (even though it should not be needed with no IDCMP flags and NOCAREREFRESH + Borderless.

To check if it may be a false positive, I checked Intellifont and IconEdit with MemLog and MemLog also reported leaks for those.

So, perhaps opening a window on the Workbench screen trigger false positives, as in opening a window always leaks? Perhaps this is documented somewhere.

I am also using 3.1.4 and compiling code with m68k-amigaos-gcc (GCC) 6.5.0b 201226214530 (thank you Bebbo!!)

Last edited by edmayn; 18 February 2021 at 23:04.
edmayn is offline  
 
Page generated in 0.05377 seconds with 11 queries