Search found 3159 matches

by Mistrel
Mon Dec 18, 2023 9:59 pm
Forum: Coding Questions
Topic: Does a fixed string prevent accidental writing beyond allocation boundaries?
Replies: 2
Views: 330

Does a fixed string prevent accidental writing beyond allocation boundaries?

If I allocate a fixed string, do I also need to perform bounds checking to ensure that assignments to that string do not exceed beyond its boundaries? I'm hesitant to say "yes", but I would like a official response. Are there any edge cases which I should be aware of? See this example wher...
by Mistrel
Sun Nov 28, 2021 11:59 am
Forum: Feature Requests and Wishlists
Topic: Requested API Structure and constants
Replies: 69
Views: 97168

Re: Requested API Structure and constants

Alternatively, you can define #PB_ListIcon_Unchecked yourself in the meantime instead of comparing with 0.
by Mistrel
Wed Nov 10, 2021 12:28 am
Forum: Coding Questions
Topic: 5.73 - Invalid memory access from AllocateMemory() during program termination
Replies: 8
Views: 3615

Re: 5.73 - Invalid memory access from AllocateMemory() during program termination

... such conditions are bound to happen because the thread is still accessing resources that the main program is in the process of cleaning up. In your case the crash is probably happening because the PB memory heap has already been destroyed when the AllocateMemory() call happens. If this is what ...
by Mistrel
Mon Nov 08, 2021 6:56 am
Forum: Coding Questions
Topic: 5.73 - Invalid memory access from AllocateMemory() during program termination
Replies: 8
Views: 3615

5.73 - Invalid memory access from AllocateMemory() during program termination

I'm experiencing intermittent [ERROR] Invalid memory access errors (read error at a random address) at an AllocateMemory() after a program has reached the end (no End keyboard; the program simply reaches the end of the main source file). The access error is inconsistent on each run but appears to be...
by Mistrel
Fri Oct 22, 2021 7:29 am
Forum: Bugs - IDE
Topic: 5.73 - Invalid memory access in the IDE
Replies: 1
Views: 4068

5.73 - Invalid memory access in the IDE

PureBasic 5.73 x86 on Windows 10. --------------------------- Error --------------------------- An Error has been detected in the IDE! Error: Invalid memory access IDE build on 11/23/2020 [10:16] by Fred Branch: master Revision: 79192e40282a --------------------------- OK ---------------------------...
by Mistrel
Thu Oct 21, 2021 11:43 am
Forum: Feature Requests and Wishlists
Topic: Requested API Structure and constants
Replies: 69
Views: 97168

Re: Requested API Structure and constants

WM_MOUSELAST identifies the last mouse-related constant between it and WM_MOUSEFIRST. As new constants were added this number was expanded. It corresponds with the features configured by the Win32 SDK. So it will always return the correct constant for what is defined but in the case of PureBasic you...
by Mistrel
Sun Oct 17, 2021 3:53 am
Forum: Feature Requests and Wishlists
Topic: Requested API Structure and constants
Replies: 69
Views: 97168

Re: Requested API Structure and constants

WM_MOUSELAST is defined as 0x0209 but has been at least 0x020a since Windows 98. Its current value is 0x020e. #if _WIN32_WINNT >= 0x0600 #define WM_MOUSELAST 0x020e #elif _WIN32_WINNT >= 0x0500 #define WM_MOUSELAST 0x020d #elif (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) #define WM_MOUSELA...
by Mistrel
Sat Oct 16, 2021 2:40 pm
Forum: Feature Requests and Wishlists
Topic: Requested API Structure and constants
Replies: 69
Views: 97168

Re: Requested API Structure and constants

WM_CLIPBOARDUPDATE 0x031D WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 WM_DWMCOMPOSITIONCHANGED 0x031e WM_DWMNCRENDERINGCHANGED 0x031f WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 WM_DWMSENDICONICTHUMBNAIL 0x0323 WM_DWMWINDOWMAXIMIZEDCHANGE 0x0321 WM_GETTITLEBARINFOEX 0x033F WM_INPUT_DEVICE_CHANGE 0x00FE WM_D...
by Mistrel
Wed Oct 13, 2021 12:02 pm
Forum: Coding Questions
Topic: Where is this memory leaking when using static strings within functions while using threads?
Replies: 2
Views: 923

Where is this memory leaking when using static strings within functions while using threads?

Tested with the latest PureBasic 5.73. I was experimenting with threads when I spotted this. The PureBasic application will continue to consume memory until it crashes: Procedure.s FuncStaticString() Static string.s string.s=LSet("",32,Chr(97+Random(25,0))) EndProcedure Procedure ThreadTes...
by Mistrel
Fri Sep 17, 2021 4:18 pm
Forum: Coding Questions
Topic: PureBasic can consume gigabytes of memory when allocating only a few object IDs
Replies: 10
Views: 3787

Re: PureBasic can consume gigabytes of memory when allocating only a few object IDs

You're right. I see the memory allocation when I enable "Committed Size" in Task Manager. It's odd how performance differs when allocating IDs incrementally vs decrementally. I also wonder what PureBasic is doing as it closes that causes the operating system to allocate memory. It shouldn'...
by Mistrel
Fri Sep 17, 2021 7:34 am
Forum: Coding Questions
Topic: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage
Replies: 19
Views: 5262

Re: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage

:| :| :| :| Alright. That makes a lot of sense. I still don't expect it to crash as a result, which it not a result of disabling the debugger but by how these functions handle being fed large numbers. The only reason I disabled the debugger at all was because of the warning which, as we've found can...
by Mistrel
Thu Sep 16, 2021 9:29 pm
Forum: Coding Questions
Topic: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage
Replies: 19
Views: 5262

Re: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage

What does the title say?
Invalid memory access on DisableDebugger line when using very large numbers with CreateImage
This is a bug.

Why do you think it's OK for the debugger point you to a completely different line than where the problem occurred?
by Mistrel
Thu Sep 16, 2021 8:09 pm
Forum: Coding Questions
Topic: PureBasic can consume gigabytes of memory when allocating only a few object IDs
Replies: 10
Views: 3787

Re: PureBasic can consume gigabytes of memory when allocating only a few object IDs

Demivec found where this is defined is in the documentation: The static, indexed way, allows you to reference an object by a predefined numeric value. The first available index number is 0 and subsequent indexes are allocated sequentially. This means that if you use the number 0 and then the number ...
by Mistrel
Thu Sep 16, 2021 7:58 pm
Forum: Coding Questions
Topic: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage
Replies: 19
Views: 5262

Re: Invalid memory access on DisableDebugger line when using very large numbers with CreateImage

Case closed. No, it's not. What does the title of the topic say? Thanks, Demivec. This was very helpful and informative. I was looking at "Handles and Numbers" in the documentation and didn't see the page you referenced. This worked without issue in PureBasic (x86) but this may have been ...
by Mistrel
Thu Sep 16, 2021 7:46 pm
Forum: Coding Questions
Topic: PureBasic can consume gigabytes of memory when allocating only a few object IDs
Replies: 10
Views: 3787

Re: PureBasic can consume gigabytes of memory when allocating only a few object IDs

It's called a hash or tree map. One has O(n) lookup and the other is O(logn). Either one would be just as fast as a static lookup table on modern computers, would use a tiny fraction of memory, and would be immune to this problem entirely.

A static array is not the only way to store a lookup table.