Memory allocation failure - subblock

Use this forum to post Vensim related questions.
Post Reply
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Memory allocation failure - subblock

Post by Dr John P Weldon »

On Tuesday 7 January 2020 'rossen', a registered member of the Vensim forum, reported that he was experiencing the error message 'Memory allocation failure - subblock'. On the same day the forum's administrator responded: 'I'll see if I can enable more memory for this'. The administrator was not asked or prompted to do this. He offered additional memory of his own volition, and because it was evidently the correct technical thing to do.

I am receiving the same error message for two large models. These, plus two smaller models, use the same C/C++ DLL. The C subprograms compile correctly under Visual Studio 2017 and Windows 10. The two smaller models run without problem under Vensim DSS 8.1.0.

The above error message is not attributable to my C subprograms. Many C subprograms were experimentally commented out of one of the larger models. The error message persisted.

I now request that additional memory should be made available to my application.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

Not sure if this has been fixed yet, but have you tried 8.2? Are you using 64 bit versions?
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

When you say "subprograms" - are these in external functions?

Unfortunately there's no guarantee that the subblock alloc is failing in the same place. It may be hard to say more without hooking the model up to a debugger.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: Memory allocation failure - subblock

Post by Dr John P Weldon »

With reference to 'tomfid'.

I am using x86 (32 bit). In my experience life has become more difficult the higher the Vensim edition (from about v7.0). I do not wish to change editions until the memory allocation failure problem has been resolved. The same problem for 'rossen' was evidently resolved without a new edition. I merely want the same consideration that he received.

Would you be willing to 'hook the model up to a debugger'? However, the same models (with the same DLL) were running normally under earlier versions of Vensim DSS. It is Vensim that has changed, not my models.

My 'subprograms' are external functions, compiled into a DLL.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Memory allocation failure - subblock

Post by Administrator »

If you remove all your calls to the sub-programs, does the error go away?

If you recall, I did update your code for you and built updated DLLs (and then deleted all occurrences of the code it on your instructions), what happens if you use those updated DLLs?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: Memory allocation failure - subblock

Post by Dr John P Weldon »

With reference to 'administrator'

It is impossible to remove all calls to subprograms. But, as many of them as possible were removed, and those calls remaining are also made in the two smaller models. Those use the same DLL and run without problem. In that sense the answer to your question is 'no'.

I do not recall when those updated DLLs might have been built. In any case they dated well before my attempted move to DSS v8.1.0, and to Visual Studio 2017. Previous updated DLLs have been superseded by the move to VS2017. The latter says that there is nothing wrong with my DLL.

I need the same solution as 'rossen' received in January 2020. Namely, an additional allocation of memory.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Memory allocation failure - subblock

Post by Administrator »

My email dated 9th April 2020 to you had the newly built 32 and 64 bit DLLs with your code in. Please use that, I no longer have it as you always as that we delete any of your files. That project will also work with the very latest version of Vensim.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

There may not be a solution in a 32 bit Vensim version, because 32 bit applications are subject to the 2-gig address space limitation. Switching to 64 bit is likely to be a more general and durable solution. Unfortunately, we can't stand still because the OS platforms have had massive turbulence in support.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: Memory allocation failure - subblock

Post by Dr John P Weldon »

I received files from the administrator on 9 April 2020. Those files would then have been processed for use as external function subprograms and compilation into a DLL.

The error message 'memory allocation failure - subblock' appears when I try to load a model into the Vensim screen. The message means that the model will not load.

In the second-largest model I had commented out many external function subprograms. That had no effect on the problem, because model size remained the same

In the largest model I have experimentally considerably reduced each of the largest array declarations: those that could be safely so reduced. This reduced model size. The model loaded into Vensim DSS and the error message was not displayed.

Evidently therefore, the error message is due to model size, including

* numbers of variable and parameters,
* sizes of array dimensions for those entities.

I again request that these models should now receive a substantial increase in allocated memory.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

Unfortunately memory is not something we can generically allocate more of. It's a common resource used by many functions - probably a few hundred at least.

I would guess that large arrays are not the problem, because that would cause a failure at runtime rather than load time. However, there might be some ways to construct arrayed equations that violate that generalization.

Taking a wild guess, one possible cause is a very long equation or lookup. The memory available for this in 64bit Vensim is 1000x that available in 32bit versions (though in a practical sense it's limited by machine memory). So, the fastest path to a solution might be to run it in a 64bit version.

If that doesn't work, we probably can't find the particular issue without access to a copy of the model.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: Memory allocation failure - subblock

Post by Dr John P Weldon »

Reference 'tomfid'

Your first paragraph has already been contradicted -- by a previous one-off or particular allocation of additional memory to another user. I am not asking for a generic anything; only the same treatment as that provided to the other user.

Your second paragraph seeks to ignore the fact that, when large arrays are reduced, the problem goes away. That is, the problem has been identified and so has the solution. Nor am I talking about runtime. This problem appears when a model is loaded. Exactly the same large arrays ran without problem in earlier versions of DSS.

I am not into wild guesses and nor should you be. In any case, I am not aware of 'a very long equation or lookup' in my models.

When my software is in the hands of its users it may be that 64bit Vensim will be used. The lengths of array dimensions that they will use may be longer than those I have specified. At this stage, however, I must get the models promptly to people who will validate them. I wish to receive an allocation of additional memory under 32bit: on the basis that the problem has already been identified, and that more memory will fix that problem now.

I request your cooperation to get this done without further delay.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Memory allocation failure - subblock

Post by Administrator »

Dr John P Weldon wrote: Thu Jan 28, 2021 1:06 pmWhen my software is in the hands of its users it may be that 64bit Vensim will be used. The lengths of array dimensions that they will use may be longer than those I have specified. At this stage, however, I must get the models promptly to people who will validate them. I wish to receive an allocation of additional memory under 32bit: on the basis that the problem has already been identified, and that more memory will fix that problem now.
32 bit processes have a limit on how much memory they can address (effectively about 1.5gb). We cannot change that. There is nothing at all we can do about that, it's an operating system limit. This is why most programs are going to 64 bit, that allows a lot more memory to be addressed.

The previous problem was related to an internal string in Vensim which had a fixed length that was not long enough. It was nothing to to with the total amount of memory that can be addressed which is what you are asking us to do.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

To say anything further, we'd have to have a copy of the model to run in the debugger - you can email it to us at vensim@vensim, or send a secure link (e.g., onedrive). If the crash happens when opening the model, we'd probably only need the mdl, venext.dll and possibly linked xls files. If it happens at runtime, we'd also need vdf and cin files that set up the run.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: Memory allocation failure - subblock

Post by Dr John P Weldon »

For my work in developing models 32bit will probably always suffice. My objective has been to confirm that one particular application will run under Vensim 8.1 and Visual Studio 2017. When that application is used by others the 64bit version may be needed.

I have not yet tried to run the application. First I must resolve COMPREAL warnings.

What is my present memory allocation under 32bit?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Memory allocation failure - subblock

Post by Administrator »

Dr John P Weldon wrote: Fri Jan 29, 2021 7:02 amWhat is my present memory allocation under 32bit?
As I've already mentioned, you should have approximately 1.5gb to work with (depending on how much memory is in your computer).
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Memory allocation failure - subblock

Post by tomfid »

Dr John P Weldon wrote: Fri Jan 29, 2021 7:02 am For my work in developing models 32bit will probably always suffice.
That's probably true for most models. Unfortunately, we won't have that choice - it's likely that all 32-bit applications will be disabled in the not-too-distant future.
Post Reply