-
Jul 1st, 2022, 03:34 PM
#41
Re: Arrays in Far Memory
I don't understand why FlushViewOfFile is necessary at all.
-
Jul 1st, 2022, 03:35 PM
#42
Re: Arrays in Far Memory
Originally Posted by The trick
You could use this class which provides the ability to alloc dynamic memory in a memory mapped file. You can use variable length strings, UDTs etc.
Trick, I'm not up for building a test at this moment. However, I'm guessing, if pushed hard enough, you'll have the same problems I'm having, as you're using the same API calls.
----------
I see that you're making some Interlocked... API calls though. I might need to study what you're doing and see if that's the solution.
----------
Also, it doesn't look like you're attempting to break the 2GB (or 4GB) boundary, as your lMaxSize is just a Long.
Last edited by Elroy; Jul 1st, 2022 at 03:40 PM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Jul 1st, 2022, 04:02 PM
#43
Re: Arrays in Far Memory
The error is in CreateSingleItemMapping method. You just check this condition:
Code:
If mpMapView = 0& Or mdwViewHigh <> dwFileOffsetHigh Or mdwViewLow <> dwFileOffsetLow Then
but you don't consider overlapping when an item is between 2 granularity regions.
-
Jul 1st, 2022, 04:11 PM
#44
Re: Arrays in Far Memory
Originally Posted by Elroy
Trick, I'm not up for building a test at this moment. However, I'm guessing, if pushed hard enough, you'll have the same problems I'm having, as you're using the same API calls.
I've described the reason of the error in the MemoryBasedArray class.
Originally Posted by Elroy
I see that you're making some Interlocked... API calls though. I might need to study what you're doing and see if that's the solution.
My class is intended for sharing between processes so it requires the atomic access when you change the memory layout.
Originally Posted by Elroy
Also, it doesn't look like you're attempting to break the 2GB (or 4GB) boundary, as your lMaxSize is just a Long.
Yes my class supports only 32-bit offsets.
-
Jul 1st, 2022, 04:21 PM
#45
Re: Arrays in Far Memory
Originally Posted by The trick
Ahhh, thank you. I missed it somehow. And missing your posts is not something I should be doing.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Jul 1st, 2022, 04:34 PM
#46
Re: Arrays in Far Memory
In The Trick's class he does not use FlushViewOfFile.
-
Jul 1st, 2022, 04:38 PM
#47
Re: Arrays in Far Memory
Originally Posted by Eduardo-
In The Trick's class he does not use FlushViewOfFile.
It isn't required if you don't care about data in the disk.
-
Jul 1st, 2022, 04:48 PM
#48
Re: Arrays in Far Memory
Yeah, I'll soon look at what he did, and fix my class (using his guidance). I'm just sort of indolent right now.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Jul 3rd, 2022, 05:52 PM
#49
Re: Arrays in Far Memory
Ok, I've fixed the problem Eduardo was having (with the bug pointed out by The Trick).
I'm also going to move this whole thing over to the CodeBank. Please continue the discussion over there.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|